-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the Checkout Session resource
- Loading branch information
1 parent
e3417e9
commit 4a9d2cd
Showing
7 changed files
with
54,978 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
from stripe.api_resources.abstract import CreateableAPIResource | ||
|
||
|
||
class CheckoutSession(CreateableAPIResource): | ||
OBJECT_NAME = 'checkout_session' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import stripe | ||
|
||
|
||
class TestCheckoutSession(object): | ||
def test_is_creatable(self, request_mock): | ||
resource = stripe.CheckoutSession.create( | ||
allowed_source_types=['card'], | ||
cancel_url='https://stripe.com/cancel', | ||
client_reference_id='1234', | ||
line_items=[ | ||
{ | ||
'amount': 123, | ||
'currency': 'usd', | ||
'description': 'item 1', | ||
'images': [ | ||
'https://stripe.com/img1', | ||
], | ||
'name': 'name', | ||
'quantity': 2, | ||
}, | ||
], | ||
payment_intent_data={ | ||
'receipt_email': 'test@stripe.com', | ||
}, | ||
success_url='https://stripe.com/success' | ||
) | ||
request_mock.assert_requested( | ||
'post', | ||
'/v1/checkout_sessions' | ||
) | ||
assert isinstance(resource, stripe.CheckoutSession) |
Oops, something went wrong.