Skip to content

Instantly share code, notes, and snippets.

@nishapanFFF
Last active February 6, 2020 17:53
Show Gist options
  • Save nishapanFFF/a8997997142011ef6a5a01267d901b1f to your computer and use it in GitHub Desktop.
Save nishapanFFF/a8997997142011ef6a5a01267d901b1f to your computer and use it in GitHub Desktop.
$billingInfo = new Recurly_BillingInfo();
// billingToken is given back to us from recurly.js javascript library when user provides Credit Card info.
// Credit card info includes bill_first_name & bill_last_name, and should have been validated by recurly.js
// before the token is generated.
$billingInfo->token_id = $billingToken;
$email = 'npdev0205-1@yopmail.com';
$account = new Recurly_Account();
$account->account_code = $email;
$account->email = $email;
$account->first_name = 'nisha'; // this is the only place we set first name
$account->last_name = 'pan'; // this is the only place we set last name
$account->address = $address; // $address obj is populated upstream
$account->billing_info = $billingInfo; // billinginfo is attached to account
$subscription = new Recurly_Subscription();
$subscription->plan_code = 'fffvip';
$subscription->currency = 'USD';
$subscription->quantity = 1;
$subscription->account = $account; // account is attached to subscription
// subscription is created in addition to account
// and i assume this is where the error "last name cannot be blank" is thrown?
$subscription->create();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment