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

Wallet and Backup Payment #604

Merged
merged 2 commits into from
Apr 16, 2021
Merged

Wallet and Backup Payment #604

merged 2 commits into from
Apr 16, 2021

Conversation

joannasese
Copy link
Contributor

@joannasese joannasese commented Apr 13, 2021

POST v2/accounts/:account_code/billing_infos

// this is actually updating an existing account with new billing infos
$account = Recurly_Account::get("accountCode");
$billingInfo = new Recurly_BillingInfo();
$billingInfo->first_name         = 'John';
$billingInfo->last_name          = 'Du Monde';
$billingInfo->address1           = '123 Paper Street';
$billingInfo->city               = 'Los Angeles';
$billingInfo->state              = 'CA';
$billingInfo->zip                = '95312';
$billingInfo->country            = 'US';
$billingInfo->phone              = '213-555-5555';
$billingInfo->number             = '4111111111111111';
$billingInfo->month              = '10';
$billingInfo->year               = '2046';
$billingInfo->primary_payment_method = true;
$billingInfo->backup_payment_method = true;
$account->createBillingInfo($billingInfo);

GET v2/accounts/{account_code}/billing_infos

$account->getBillingInfos();

GET v2/accounts/{account_code}/billing_infos/{uuid}

$account->getBillingInfo("billingInfoId");

PUT v2/accounts/{account_code}/billing_infos/{billing_info_id}

$binfoToUpdate = $account->getBillingInfo("billingInfoId");
$account->updateBillingInfo($binfoToUpdate);

DELETE v2/accounts/{account_code}/billing_infos/{billing_info_id}

$account->deleteBillingInfo("billingInfoId");

POST v2/accounts and PUT v2/accounts/{account_code}
These endpoints are documented https://developers.recurly.com/api-v2/v2.29/index.html#operation/updateAccountsBillingInfoCreditCard and https://developers.recurly.com/api-v2/v2.29/index.html#operation/updateAccount, for example.

POST v2/purchases

$purchase = new Recurly_Purchase();
$purchase->currency = 'USD';
$purchase->collection_method = 'automatic';

$purchase->account = new Recurly_Account();
$purchase->account->account_code = $account->account_code;
$binfo = Recurly_BillingInfoList::take(1, $account->account_code)[1];
$purchase->billing_info_uuid = $binfo->uuid;
...
$collection = Recurly_Purchase::invoice($purchase);

POST v2/subscriptions

$subscription = new Recurly_Subscription();
$subscription->plan_code = $plan->plan_code;
$subscription->currency = 'USD';
$binfo = Recurly_BillingInfoList::take(1, $account->account_code)[1];
$subscription->billing_info_uuid = $binfo->uuid;
$subscription->account = $account;
$subscription->create();

PUT v2/subscriptions/{uuid}

$subscription = Recurly_Subscription::get("5a27e5e57fccf9bcb7af0b4770a786d5");
$binfo = Recurly_BillingInfoList::take(1, $account->account_code)[1];
$subscription->billing_info_uuid = $binfo->uuid;
$subscription->updateImmediately();

PUT v2/invoices/{invoice_number}/collect

$invoice = Recurly_Invoice::get("2504");
$binfo = Recurly_BillingInfoList::take(1, $account->account_code)[1];
$invoice->billing_info_uuid = $binfo->uuid;
$invoice->forceCollect();

@naspthorp naspthorp merged commit 3ded12d into v2 Apr 16, 2021
@naspthorp naspthorp deleted the sim-422-wallet branch April 16, 2021 21:05
recurly-integrations pushed a commit that referenced this pull request Apr 22, 2021
[Full Changelog](2.12.20...2.12.21)

**Merged Pull Requests**

- Wallet and Backup Payment [#604](#604) ([joannasese](https://github.com/joannasese))
- Correct changelog year from 2020 to 2021 [#584](#584) ([joannasese](https://github.com/joannasese))
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

3 participants