Shell Python Node PHP C# Ruby

Payment Links

Payload Payment Links are a simple and useful tool for accepting payments via secure links. A payment link will generate a stand-alone and secure payment page that can be sent via email, text, QR code or linked to from any webpage as either a one-time or reusable link.

Basic One-time Link

curl "https://api.payload.com/payment_links/" \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
    -d type="one_time" \
    -d description="Payment Request" \
    -d amount="10" \
    -d processing_id="acct_3brhxEXpz2qEJ8vnIXbvW"
payment_link = pl.PaymentLink.create(
    type='one_time',
    description='Payment Request',
    amount=10.00, # Optional
    processing_id='acct_3brhxEXpz2qEJ8vnIXbvW'
)
payment_link = Payload::PaymentLink.create(
    type: 'one_time',
    description: 'Payment Request',
    amount: 10.00, # Optional
    processing_id: 'acct_3brhxEXpz2qEJ8vnIXbvW'
)
<?php
$payment_link = Payload\PaymentLink::create(array(
    'type' => 'one_time',
    'description' => 'Payment Request',
    'amount' => 10.00, # Optional
    'processing_id' => 'acct_3brhxEXpz2qEJ8vnIXbvW'
));
?>
const payment_link = await pl.PaymentLink.create({
    type: 'one_time',
    description: 'Payment Request',
    amount: 10.00,  /* Optional */
    processing_id: 'acct_3brhxEXpz2qEJ8vnIXbvW'
})
var payment_link = await pl.PaymentLink.CreateAsync(new {
    type = "one_time",
    description = "Payment Request",
    amount = 10.00, /* Optional */
    processing_id = "acct_3brhxEXpz2qEJ8vnIXbvW"
});

Creating a basic link just requires a short description and the processing_id of the payment. You can either specify an amount or allow the client to enter the amount themselves. Payment links also accept a customer_id key, which will enable an automatic email to be sent directly to the client.


Associate an Invoice

Associate an Invoice

curl "https://api.payload.com/payment_links/" \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
    -d invoice_id="inv_3bha7EXpz2qEJ8vnIXhs8'
payment_link = pl.PaymentLink.create(
    invoice_id='inv_3bha7EXpz2qEJ8vnIXhs8'
)
payment_link = Payload::PaymentLink.create(
    invoice_id: 'inv_3bha7EXpz2qEJ8vnIXhs8'
)
<?php
$payment_link = Payload\PaymentLink::create(array(
    'invoice_id' => 'inv_3bha7EXpz2qEJ8vnIXhs8'
));
?>
const payment_link = await pl.PaymentLink.create({
    invoice_id: 'inv_3bha7EXpz2qEJ8vnIXhs8'
})
var payment_link = await pl.PaymentLink.CreateAsync(new {
    invoice_id = "inv_3bha7EXpz2qEJ8vnIXhs8"
});

An Invoice can be paid through a Payment Link page. To associate a payment link to an invoice, set the invoice_id on the payment link.


Include Additional Data Fields

Additional Data Fields

curl "https://api.payload.com/payment_links/" \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
    -d type="one_time" \
    -d description="Payment Request" \
    -d amount="10" \
    -d processing_id="acct_3brhxEXpz2qEJ8vnIXbvW" \
    -d additional_datafields[0][section]="Extra Fields" \
    -d additional_datafields[0][fields][0][title]="Field Name"
payment_link = pl.PaymentLink.create(
    type='one_time',
    description='Payment Request',
    amount=10.00,
    processing_id='acct_3brhxEXpz2qEJ8vnIXbvW',
    additional_datafields=[{
        'section': 'Extra Fields',
        'fields': [{ 'title': 'Field Name' }]
    }]
)
payment_link = Payload::PaymentLink.create(
    type: 'one_time',
    description: 'Payment Request',
    amount: 10.00,
    processing_id: 'acct_3brhxEXpz2qEJ8vnIXbvW',
    additional_datafields: [{
        section: 'Extra Fields',
        fields: [{
            title: 'Field Name'
        }]
    }]
)
<?php
$payment_link = Payload\PaymentLink::create(array(
    'type' => 'one_time',
    'description' => 'Payment Request',
    'amount' => 10.00,
    'processing_id' => 'acct_3brhxEXpz2qEJ8vnIXbvW',
    'additional_datafields' => array(array(
        'section' => 'Extra Fields',
        'fields' => array(array( 'title' => 'Field Name' ))
    ))
));
?>
const payment_link = await pl.PaymentLink.create({
    type: 'one_time',
    description: 'Payment Request',
    amount: 10.00,
    processing_id: 'acct_3brhxEXpz2qEJ8vnIXbvW',
    additional_datafields: [{
        section: 'Extra Fields',
        fields: [{ title: 'Field Name' }]
    }]
})
var payment_link = await pl.PaymentLink.CreateAsync(new {
    type = "one_time",
    description = "Payment Request",
    amount = 10.00,
    processing_id = "acct_3brhxEXpz2qEJ8vnIXbvW",
    additional_datafields = new []{
        new {
            section="Extra Fields",
            fields=new []{
                new{ title = "Field Name" }
            }
        }
    }
});

If there are additional data or form fields that should be collected with each payment, additional_datafields can accept a list of additional fields grouped by sections. The resulting data field values will be stored in the resulting payment's attrs object.

Field options

option type description
name string The name value of the resulting input
title string The title or label of the input
confirm bool Flag for if the input should be retyped for confirmation
type string The type of the input: text, email, tel, date
value string Autofill the value
details string Additional details or description of the input
placeholder string Placeholder value for the input
autocomplete_url string Specify a URL of values to use for autocompletion
optional bool Flag to specify if the field is optional
readonly bool Flag to specify if the field is readonly

Enable/Disable Customer Fields

option type description
customer_fields string Valid values: required or disabled

Reusable Link

curl "https://api.payload.com/payment_links/" \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
    -d type="reusable" \
    -d description="Payment Request" \
    -d processing_id="acct_3brhxEXpz2qEJ8vnIXbvW"
payment_link = pl.PaymentLink.create(
    type='reusable',
    description='Payment Request',
    processing_id='acct_3brhxEXpz2qEJ8vnIXbvW'
)
payment_link = Payload::PaymentLink.create(
    type: 'reusable',
    description: 'Payment Request',
    processing_id: 'acct_3brhxEXpz2qEJ8vnIXbvW'
)
<?php
$payment_link = Payload\PaymentLink::create(array(
    'type' => 'reusable',
    'description' => 'Payment Request',
    'processing_id' => 'acct_3brhxEXpz2qEJ8vnIXbvW'
));
?>
const payment_link = await pl.PaymentLink.create({
    type: 'reusable',
    description: 'Payment Request',
    processing_id: 'acct_3brhxEXpz2qEJ8vnIXbvW'
})
var payment_link = await pl.PaymentLink.CreateAsync(new {
    type = "reusable",
    description = "Payment Request",
    processing_id = "acct_3brhxEXpz2qEJ8vnIXbvW"
});

A reusable secure payment link can be used as a static page to accept as many payments as needed. Reusable links are great for adding a static link directly from any website or page that may be used to collect payments from visitors.


Attach a File

Attach a File

payment_link = pl.PaymentLink.create(
    type='one_time',
    description='Payment Request',
    attachments = [{'file':file1}, {'file':file_2}],
    amount=10.00,
    processing_id='acct_3bz0zU9dAX06SJwfMmfn0'
)

Files with extensions: 'svg','pdf','png' can be attached to a payment link within the attachments field. These are available to view and download when a customer accesses the link.


Statuses

status description
active Payment link is active and ready to use
inactive Payment link is not active and cannot be used
sent Payment link has been sent
delivered Payment link has been delivered
completed Payment link amount has been paid
bounced Payment link not been delivered
expired Payment link has expired