Preparing Subscriptions Using Digital Wallet Data
Set up recurring subscriptions when a customer pays with Apple Pay or Google Pay, storing their payment method for ongoing billing.
Create Subscription in One Call
$post = array(
'security_key' => YOUR_PRIVATE_KEY,
'type' => 'sale',
'amount' => '9.99',
'payment_token' => $payment_token,
'customer_vault' => 'add_customer',
'customer_vault_id' => 'SUB-' . $user_id,
'recurring' => 'add_subscription',
'plan_payments' => '0', // 0 = indefinite
'plan_amount' => '9.99',
'month_frequency' => '1',
'day_of_month' => '1',
'start_date' => date('Y-m-d', strtotime('+1 month')),
);
Managing Subscriptions
// Update amount
$post = array('security_key' => YOUR_PRIVATE_KEY, 'recurring' => 'update_subscription',
'subscription_id' => $id, 'plan_amount' => '14.99');
// Cancel
$post = array('security_key' => YOUR_PRIVATE_KEY, 'recurring' => 'delete_subscription',
'subscription_id' => $id);