NAV Navbar
Logo

Payment Links Tutorial

Payload’s Payment Link feature allows you to easily accept one-time or recurring payments.

How Does it Work

Get Started

If you don’t already have at least one dedicated Processing Account for your business, you’ll need to set one up, otherwise jump to Create a Payment Link.

Adding a Processing Account

Add a Processing Account

<script src="https://payload.co/Payload.js"
  pl-client-key="client_key_AWcpDnNBB7oLfNqfQ6g66262"
  pl-btn-open="processing-account">
</script>
<script>
var pl = Payload('client_key_AWcpDnNBB7oLfNqfQ6g66262')
new pl.ProcessingAccount()
    .on('account_created', function(evt) {
        console.log(evt.account)
    })
</script>

Response

{}

Every payment needs to be associated with an active Processing Account to process. Processing Accounts specify the pricing and settings for how payments should be processed, including what funding account to transmit the payment to.

Processing Accounts can be added through the dashboard or the full setup process can be integrated into your platform using the Integrated Processing Account Setup toolkit.

To integrate the processing account setup into your app or platform, you can use the Processing Account UI toolkit to capture the details for a new processing account.

Below is an example of the Processing Account form. Click the button to view.


Add a Customer

Create a New Customer

curl "https://api.payload.co/accounts/" \
  -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
  -d email="matt.perez@example.com" \
  -d full_name="Matt Perez" \
  -d primary_processing_id="processing_account_id" \
  -d phone_number="1234567890" \
  -d type="customer"
account = pl.Customer.create(
    full_name='Full name',
    email='email@example.com',
    phone_number='(111) 111-1111',
    attrs={
      "custom_attribute": "Custom input"
    },
    primary_processing_id='processing_account_id'
)
pl.Customer.create({
    full_name: 'Full name',
    email: 'email@example.com',
    phone_number: '(111) 111-1111',
    attrs: {
      "custom_attribute": "Custom input"
    },
    primary_processing_id: 'processing_account_id'
}).then(function(account) {
    // Handle account creation
})

Response

{}

When a user signs up, create a new Customer using one of Payload’s SDKs.


Create a Payment Link

Create a Payment Link

curl "https://api.payload.co/payment_links/" \
 -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
 -d amount=59.99 \
 -d description="Services rendered" \
 -d type="one_time" \
 -d processing_id="3brhxEXpz2qEJ8vnIXbvW"
payment_link = pl.PaymentLink.create(
    amount=99.99,
    description='Description',
    type='one_time',
    processing_id='3brhxEXpz2qEJ8vnIXbvW'
)
pl.PaymentLink.create({
    amount: 99.99,
    description: 'Description',
    type: 'one_time',
    processing_id: '3brhxEXpz2qEJ8vnIXbvW'
}).then(function(payment_link) {
    // Handle payment_link creation
})

Response

{}

Payment Links are auto-generated, secure links to online payment forms. Simply specify a description, a type (one_time or reusable) and a Processing Account ID, and you can begin accepting payments immediately. You can specify an amount, or leave it blank to allow the customer to input any amount.


Track Payments with Webhooks

Create a Webhook

curl "https://api.payload.co/webhooks/" \
  -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
  -d trigger="payment" \
  -d url="https://api.your-app.com/webhooks-endpoint"
webhook = pl.Webhooks.create(
    trigger='payment',
    url='https://api.your-app.com/webhooks-endpoint'
)
pl.Webhooks.create({
    trigger: 'payment',
    url: 'https://api.your-app.com/webhooks-endpoint'
}).then(function(webhook) {
    // Handle webhook creation
})

Response

{}

Use Payload’s webhooks to watch for successful and unsuccessful payments. Some useful triggers are: automatic_payment, payment, bank_account_reject, and decline. For a full list of webhook triggers, see the Object Reference.


When a webhook is triggered, a Webhook Log will be sent via POST request to the url in your webhook.

Create a webhook that triggers on payment, then make a payment using the demo payment link.

Your webhook log should appear below:

Create a webhook and trigger it to view webhook logs

Object Reference