If a customer has a payment method with the default_payment_method
flag
set to true
on one of their stored payment methods,
that payment method will be automatically charged
on the due date of any invoice that they are assigned to with an outstanding balance.
See customer default payment method
If an invoice remains open with an outstanding balance for a customer with a default billing method enabled, the payment will be re-attempted for up to 5 days after the due date.
Note: Any declined transactions will create a payment line item with a zero amount on the associated invoice.
To disable automatic payment attempts on a invoice that's within 5 days from the due date you can update the status on the invoice to
canceled
, delete the invoice, or disable the customer's default payment method.
To stop future automatic payments for a billing schedule you'll need to either
disable the customer's default payment method, delete the billing schedule, or
update the end_date
on the billing schedule to the current date or a date in the past.
You can subscribe to webhooks or use the query api to monitor or review any automatic payments and payment attempts.
Watch for payment triggers in real-time using the automatic_payment
webhook. If you want to monitor both
automatic and manually authorized payments, the payment
webhook will
fire for both types of payments.
Query for automatic payments
curl "https://api.payload.co/transactions/?type=payment&trigger=automatic" \
-u secret_key_3bW9JMZtPVDOfFNzwRdfE:
payments = pl.Payment.filter_by( trigger='automatic' ).all()
payments = Payload::Payment.
filter_by(
trigger: 'automatic'
).
all()
<?php
$payments = Payload\Transaction::filter_by(
array('trigger'=>'automatic', 'type'=>'payment'))->all();
?>
const payments = await pl.select(pl.Payment).filterBy({ trigger: 'automatic' })
var payments = await pl.Payment.FilterBy(new { trigger = "automatic" }).AllAsync();
To query for automatic payments, you can use the hidden attribute trigger
which is set
to automatic
for any automatic payment attempt.
To use polling to find the most recent automatic payments, you can use the trigger
filter along with a greater than query operator on the created_at
attribute. See below for more
information on using query operators: