Shell Python Node PHP C# Ruby

Associate a Customer


Specify a Customer

<input type="hidden" pl-input="customer_id" value="acct_3bW9JMapnT7sw7neax7ui">
<script>
new Payload.Form({
    form: document.getElementById('billing-details-form'),
    payment_method: { customer_id: 'acct_3bW9JMapnT7sw7neax7ui' }
})
</script>

Payment details can be associated with a customer account by adding a customer_id data input to the payment method form or setting the customer_id via the javascript interface.

Once card details have been stored, you can access the stored payment methods from the Customer Object.


cust = pl.Customer.get('acct_3bW9JMapnT7sw7neax7ui')
print(cust.payment_methods)
pl.Customer.get("acct_3bW9JMapnT7sw7neax7ui")
    .then(function(cust) {
        console.log(cust.payment_methods)
    })
cust = Payload::Customer.get('acct_3bW9JMapnT7sw7neax7ui')
puts(cust.payment_methods)
$cust = Payload\Customer::get('acct_3bW9JMapnT7sw7neax7ui');
echo($cust->payment_methods);
var cust = pl.Customer.get('acct_3bW9JMapnT7sw7neax7ui')
Console.WriteLine(cust.payment_methods);

Set Payment Method as Default

<input type="hidden" pl-input="default_payment_method" value="true">

A default payment method of a customer account can be set by passing a default_payment_method data input with a value of true.

If a default payment method was specified, any payment charged for that customer will be triggered with their default payment method unless otherwise specified.