Skip to content

Instantly share code, notes, and snippets.

@nishapanFFF
Created March 8, 2019 23:35
Show Gist options
  • Save nishapanFFF/2d0cfe3de070e1524ab210f477c5ec2b to your computer and use it in GitHub Desktop.
Save nishapanFFF/2d0cfe3de070e1524ab210f477c5ec2b to your computer and use it in GitHub Desktop.
try {
$subscription = new Recurly_Subscription();
$subscription->plan_code = 'fffvip';
$subscription->currency = 'USD';
$subscription->quantity = 1;
$accountcode = 'nplocalsgtf0301_14@yopmail.com';
$account = Recurly_Account::get($accountcode);
$billing_info = new Recurly_BillingInfo();
$billing_info->token_id = $billingToken; //token contains bad credit card
$account->billing_info = $billingInfo;
$subscription->account = $account;
$subscription->create();
} catch (Exception $e)
{
// Ian: $e is Recurly_ValidationError without any transcation error info.
// can you confirm if $e->getMessage() would give us the same message as Recurly_TransactionError > customer_message?
$message_for_user = $e->getMessage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment