Shell Python Node PHP C# Ruby

Customers

Create a New Customer

curl "https://api.payload.co/customers/" \
    -u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
    -d email="matt.perez@example.com" \
    -d name="Matt Perez"
account = pl.Customer.create(
    email='matt.perez@example.com',
    name='Matt Perez',
    primary_processing_id=processing.id
)
account = Payload::Customer.create(
    email: 'matt.perez@example.com',
    name: 'Matt Perez'
)
<?php
$account = Payload\Customer::create(array(
    'email' => 'matt.perez@example.com',
    'name' => 'Matt Perez'
));
?>
pl.Customer.create({
    email: 'matt.perez@example.com',
    name: 'Matt Perez'
}).then(function(account){
})
var account = pl.Customer.create(new {
    email="matt.perez@example.com",
    name="Matt Perez"
});

To create a customer account, the customer API requires the customer's email address and name. If you have more than one processing account, you can specify the primary processing account for the customer by including the primary_processing_id attribute.

Once a customer account is created it can be used throughout the different APIs to associate and track payment methods, transactions, invoices, and billing schedules with a specific customer.

Default Payment Method

A key feature of customer accounts is being able to setup automated billing. With a default payment method you can:

To enable a default billing method, set the default_payment_method flag to true on the customer's payment method selected for automatic billing and payments.

Customer Checkout UI

<form action="/submit_payment" method="POST">
  <script src="https://payload.co/Payload.js"
    pl-client-key="client_key_AWcpDnNBB7oLfNqfQ6g66262"
    pl-amount="100.00"
    pl-description="Membership"
    pl-customer-id="{customer_id}">
  </script>
</form>

Once you've created a customer account, you can pass the customer_id to the Checkout UI using the data-customer-id parameter.

This will load any stored payment methods and settings for that customer and allow them to update their payment options.