Set up recurring payments
Store the underlying card from an Apple Pay transaction and use it for recurring charges or subscriptions.
When Pay.com processes an Apple Pay transaction, it stores the underlying card
used for the payment as a standard payment method (pm_card_...). This stored
card behaves identically to any other saved card on Pay.com and can be used
for both merchant-initiated charges and subscription billing.
Retrieve the stored payment method ID
How you retrieve the pm_card_... ID depends on the integration path used
for the initial Apple Pay payment.
Create the payment session with "setup_future_usage": "off_session" so
the card is stored for merchant-initiated use:
{
"amount": 1000,
"currency": "usd",
"customer_reference_id": "cust-001",
"payment_method_types": ["applepay"],
"setup_future_usage": "off_session"
}1000 is $10.00 (amounts are in minor units). Then retrieve the
pm_card_... ID from the onSuccess callback after the customer
completes the initial Apple Pay payment. The SDK returns response keys in
camelCase, so the ID is in payment.paymentMethod:
const checkout = pay.checkout({
clientSecret: '{client_secret}',
onSuccess: (payment) => {
const paymentMethodId = payment.paymentMethod
// Store paymentMethodId against the customer in your database
},
onFailure: (error) => {
console.error(error.message)
},
})Create recurring charges or subscriptions
Once you have the pm_card_... ID, you can use it to charge the customer
without them being present. There are two paths depending on your billing
model:
-
Recurring charges: trigger each charge manually using the stored
pm_card_...ID with"off_session": true. See the recurring charges guide for the full request format, all targeting methods, response handling, and webhook events. -
Subscriptions: attach the stored
pm_card_...ID to a subscription package and let Pay.com manage the billing schedule automatically. See the subscriptions guide for the full setup instructions.