-
Notifications
You must be signed in to change notification settings - Fork 850
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor CurlClient * Public interface * Test * Better tests * Better test * Nicer types * Add README.md entry * encoding -> api_mode, support preview syntax * Fix additional headers * Generate preview version and formatting * default to preview version if api mode is preview * stripe_context * Use setMethods, extract preview tests into separate file * actually add preview tests * fix tests * fix tests * remove old error handling * feedback round 1 * assertEquals * lint * don't include stripe_version in preview default opts * LINT --------- Co-authored-by: Annie Li <[email protected]>
- Loading branch information
1 parent
4209ec9
commit 30de322
Showing
6 changed files
with
247 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ If you use Composer, these dependencies should be handled automatically. If you | |
Simple usage looks like: | ||
|
||
```php | ||
$stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); | ||
$stripe = new \Stripe\StripeClient('sk_test_xyz'); | ||
$customer = $stripe->customers->create([ | ||
'description' => 'example customer', | ||
'email' => '[email protected]', | ||
|
@@ -223,6 +223,31 @@ If your beta feature requires a `Stripe-Version` header to be sent, set the `api | |
Stripe::addBetaVersion("feature_beta", "v3"); | ||
``` | ||
|
||
### Custom requests | ||
|
||
If you | ||
- would like to send a request to an undocumented API (for example you are in a private beta) | ||
- prefer to bypass the method definitions in the library and specify your request details directly, | ||
- used the method `_request` on `ApiResource` to specify your own requests. `_request` would soon be deprecated and removed. | ||
|
||
you can use the `rawRequest` method on the StripeClient. | ||
|
||
```php | ||
$stripe = new \Stripe\StripeClient('sk_test_xyz'); | ||
$response = $stripe->rawRequest('post', '/v1/beta_endpoint', [ | ||
"caveat": "emptor" | ||
], [ | ||
"stripe_version" => "2024-06-20", | ||
]); | ||
// $response->body is a string, you can call $stripe->deserialize to get a \Stripe\StripeObject. | ||
$obj = $stripe->deserialize($response->body); | ||
|
||
// For GET requests, the params argument must be null, and you should write the query string explicitly. | ||
$get_response = $stripe->rawRequest('get', '/v1/beta_endpoint?caveat=emptor', null, [ | ||
"stripe_version" => "2022-11_15", | ||
]); | ||
``` | ||
|
||
## Support | ||
|
||
New features and bug fixes are released on the latest major version of the Stripe PHP library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters