Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Version 2.9 #337

Merged
merged 2 commits into from
Nov 21, 2017
Merged

API Version 2.9 #337

merged 2 commits into from
Nov 21, 2017

Conversation

bhelx
Copy link
Contributor

@bhelx bhelx commented Nov 20, 2017

This PR contains the changes needed to bump to API version 2.9.

  1. Adding the authorize endpoint for Purchases. You can read about authorize in the dev docs. Example:
$purchase = new Recurly_Purchase();
$purchase->currency = 'USD';
$purchase->collection_method = 'automatic';
$purchase->account = new Recurly_Account();
// In this case, email is required
$purchase->account->email = 'benjamin.dumonde@example.com';
$purchase->account->account_code = 'aa61-4790-8e61-0a2692435fee';
$purchase->account->first_name = "Benjamin";
$purchase->account->last_name = "Du Monde";
$purchase->account->address->phone = "555-555-5555";
$purchase->account->address->email = "verena@example.com";
$purchase->account->address->address1 = "123 Main St.";
$purchase->account->address->city = "San Francisco";
$purchase->account->address->state = "CA";
$purchase->account->address->zip = "94110";
$purchase->account->address->country = "US";

$billing_info = new Recurly_BillingInfo();
$billing_info->number = '4111-1111-1111-1111';
$billing_info->month = 12;
$billing_info->year = 2019;
$billing_info->verification_value = '123';
$billing_info->address1 = '400 Alabama St';
$billing_info->city = 'San Francisco';
$billing_info->state = 'CA';
$billing_info->country = 'US';
$billing_info->zip = '94110';
// Tells Recurly that an external payment collection method will be used.
// In this case, Adyen HPP.
$billing_info->external_hpp_type = 'adyen';

$purchase->account->billing_info = $billing_info;

$adjustment = new Recurly_Adjustment();
$adjustment->unit_amount_in_cents = 1000;
$adjustment->quantity = 1;

$purchase->adjustments = array($adjustment);

$subscription = new Recurly_Subscription();
$subscription->plan_code = 'gold1';

try {
  $authorized_invoice = Recurly_Purchase::authorize($purchase);
  print($authorized_invoice);
} catch (Recurly_ValidationError $e) {
  print($e);
} catch (Recurly_Error $e) {
  print($e);
}
  1. Not a code change, but the subscription link on an instance of Recurly_Adjustment is now only created if adjustment is originating from a subscription plan charge, setup fee, add on, trial or proration credit. It is no longer created for other adjustments.

  2. Also not a code change, but instances of Recurly_Transaction and Recurly_Invoice no longer have a subscription link and you must now use the subscriptions link.

Added authorize endpoint for Purchases.
@bhelx bhelx requested a review from drewish November 20, 2017 21:41
Copy link

@drewish drewish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@drewish drewish merged commit 6385756 into master Nov 21, 2017
@drewish drewish deleted the api_version_2_9 branch November 21, 2017 13:40
@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants