Shell Python Node PHP C# Ruby

Handling Successful Payment

The customer and admin will receive email receipts after a successful payment. A redirect_url can be provided as well which will redirect the page after a payment has been completed.

To monitor for a successful payment programmatically, a webhook can be registered as described below.

Webhooks

Payment Link Webhooks

curl "https://api.payload.co/payment_links/" \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
    -d type="one_time" \
    -d description="Payment Request" \
    -d amount="10" \
    -d processing_id="acct_3brhxEXpz2qEJ8vnIXbvW" \
    -d webhooks[0][trigger]=payment \
    -d webhooks[0][url]="https://example.com/payment-link/payments" \
    -d webhooks[1][trigger]=decline \
    -d webhooks[1][url]="https://example.com/payment-link/payments"
payment_link = pl.PaymentLink.create(
    type='one_time',
    description='Payment Request',
    amount=10.00, # Optional
    processing_id='acct_3brhxEXpz2qEJ8vnIXbvW',
    webhooks=[
        new pl.Webhook(
            trigger='payment',
            url='https://example.com/payment-link/payments'
        ),
        new pl.Webhook(
            trigger='decline',
            url='https://example.com/payment-link/declines'
        )
    ]
)
payment_link = Payload::PaymentLink.create(
    type: 'one_time',
    description: 'Payment Request',
    amount: 10.00, # Optional
    processing_id: 'acct_3brhxEXpz2qEJ8vnIXbvW',
    webhooks: [
        Payload::Webhook.new(
            trigger: 'payment',
            url: 'https://example.com/payment-link/payments'
        ),
        Payload::Webhook.new(
            trigger: 'decline',
            url: 'https://example.com/payment-link/declines'
        )
    ]
)
<?php
$payment_link = Payload\PaymentLink::create(array(
    'type' => 'one_time',
    'description' => 'Payment Request',
    'amount' => 10.00, # Optional
    'processing_id' => 'acct_3brhxEXpz2qEJ8vnIXbvW',
    'webhooks' => array(
        Payload\Webhook(array(
            'trigger' => 'payment',
            'url' => 'https://example.com/payment-link/payments'
        )),
        Payload\Webhook(array(
            'trigger' => 'decline',
            'url' => 'https://example.com/payment-link/declines'
        ))
    )
));
?>
const payment_link = await pl.PaymentLink.create({
    type: 'one_time',
    description: 'Payment Request',
    amount: 10.00,  /* Optional */
    processing_id: 'acct_3brhxEXpz2qEJ8vnIXbvW',
    webhooks: [
        new pl.Webhook(
            trigger: 'payment',
            url: 'https://example.com/payment-link/payments'
        ),
        new pl.Webhook(
            trigger: 'decline',
            url: 'https://example.com/payment-link/declines'
        )
    ]
})
var payment_link = await pl.PaymentLink.CreateAsync(new {
    type = "one_time",
    description = "Payment Request",
    amount = 10.00, /* Optional */
    processing_id = "acct_3brhxEXpz2qEJ8vnIXbvW",
    webhooks = new [] {
        new pl.Webhook(new {
            trigger="payment",
            url="https://example.com/payment-link/payments"
        }),
        new pl.Webhook(new {
            trigger="decline",
            url="https://example.com/payment-link/declines"
        })
    }
});

You can specify an array of webhook objects with the webhooks attribute to register decline or payment webhooks for any payment attempts initiated from the generated payment link.

Universal Webhook

You can also register a single webhook to watch for all successful or declined payments. To determine what the originating payment link was for a given payment you can request the transaction's hidden field payment_link_id. For more information see the Webhook section.