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

Add header to API Call #824

Open
bobalbert opened this issue Sep 13, 2024 · 1 comment
Open

Add header to API Call #824

bobalbert opened this issue Sep 13, 2024 · 1 comment
Labels

Comments

@bobalbert
Copy link

Warning: Github issues are not an official support channel for Recurly. If you have an urgent request we suggest you contact us through an official channel: [email protected] or https://recurly.zendesk.com

I've contacted Recurly support but having issues getting someone with any knowledge of or experience with the PHP client.

We just did an account billing migration from one Recurly account another Recurly account and now i'm trying to create no card/billing trials to setup the subscriptions from the old Recurly account.
option 2 free trial method: https://docs.recurly.com/docs/customer-imports#3-create-subscriptions

The Migration team has told me I need to make sure not to do any card validation when creating these subs by adding a special header to the API call to tell Recurly to skip authorization on the card which they have provided. this is to make sure migrated CIT/NTID data is not overwritten.

I don't see anyway to pass/add headers to the _sendRequest() method in client.php via my $subscription->create() call and support is unable to help me and doesn't seem to know how to do it either.

It seems like I have to manually add this to the method's curl header setup as another value? This is kind of a one off, so I assume this is really the only way to do it?
client.php ~ line 164 through 184
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/xml; charset=utf-8', 'Accept: application/xml', Recurly_Client::__userAgent(), 'Accept-Language: ' . $this->_acceptLanguage, 'X-Api-Version: ' . Recurly_Client::$apiVersion, 'Recurly-Skip-Authorization: true'

Or is their another preferred way?

I have done the manual option and it seems to work but i get in consistent behavior where some subscriptions are created but others are failing a validation of the card:
[recurly_validationerror] => Array ( [0] => Your card number is not valid. Please update your card number. )

i'm doing a very basic call..
create a sub - $subscription = new Recurly_Subscription();
set the plan_code, currency
the trial_at_end - $subscription->trial_ends_at = $next_payment_date;
setup an account - $account = new Recurly_Account();
set the recurly_account_id, email, name address
then set the account to the sub - $subscription->account = $account;
then create the sub - $subscription->create();

Thoughts? Advice? Thanks,
Bob

@douglasmiller
Copy link
Contributor

@bobalbert, you can include headers, with an associative array of header name => value pairs, in the options of any client operation.

I'll see about having this behavior documented better in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants