Create a New Customer
curl "https://api.payload.co/customers/" \
-u secret_key_3bW9JMZtPVDOfFNzwRdfE: \
-d email="[email protected]" \
-d name="Matt Perez"
account = pl.Customer.create(
email='[email protected]',
name='Matt Perez',
primary_processing_id=processing.id
)
account = Payload::Customer.create(
email: '[email protected]',
name: 'Matt Perez'
)
<?php
$account = Payload\Customer::create(array(
'email' => '[email protected]',
'name' => 'Matt Perez'
));
?>
const customer = await pl.Customer.create({
email: '[email protected]',
name: 'Matt Perez'
})
var account = await pl.Customer
.CreateAsync(new {
email = "[email protected]",
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.
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.
Some cases may require a one-time payment by a customer without saving their payment method. To enable this behavior
set the keep_active
flag to false
on the customer object.
<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.