You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -303,6 +303,108 @@ The credit card charge result may contains `redirect_url` for 3DS authentication
303
303
For full example on Credit Card 3DS transaction refer to:
304
304
-[Flask App examples](/examples/flask_app) that implement Snap & Core Api
305
305
306
+
### 2.2.D Subscription API
307
+
308
+
You can see some Subscription API examples [here](examples/subscription), [Subscription API Docs](https://api-docs.midtrans.com/#subscription-api)
309
+
310
+
#### Subscription API for Credit Card
311
+
312
+
To use subscription API for credit card, you should first obtain the 1-click saved token, [refer to this docs.](https://docs.midtrans.com/en/core-api/advanced-features?id=recurring-transaction-with-subscriptions-api)
313
+
314
+
You will receive `saved_token_id` as part of the response when the initial card payment is accepted (will also available in the HTTP notification's JSON), [refer to this docs.](https://docs.midtrans.com/en/core-api/advanced-features?id=sample-3ds-authenticate-json-response-for-the-first-transaction)
To use subscription APIfor gopay, you should first link your customer gopay account with gopay tokenization API, [refer to this section](#22e-tokenization-api)
373
+
374
+
You will receive gopay payment token using `get_payment_account`API call
375
+
376
+
You can see some Subscription API examples [here](examples/subscription)
377
+
378
+
### 2.2.E Tokenization API
379
+
You can see some Tokenization API examples [here](examples/tokenization), [Tokenization API Docs](https://api-docs.midtrans.com/#gopay-tokenization)
380
+
381
+
```python
382
+
# Create Tokenization API instance
383
+
core_api= midtransclient.CoreApi(
384
+
is_production=False,
385
+
server_key='YOUR_SERVER_KEY',
386
+
client_key='YOUR_CLIENT_KEY'
387
+
)
388
+
# Prepare parameter
389
+
param= {
390
+
"payment_type": "gopay",
391
+
"gopay_partner": {
392
+
"phone_number": "81234567891",
393
+
"country_code": "62",
394
+
"redirect_url": "https://mywebstore.com/gopay-linking-finish"#please update with your redirect URL
>**IMPORTANTNOTE**: To update transaction status on your backend/database, **DONOT** solely rely on frontend callbacks! For security reason to make sure the status is authentically coming from Midtrans, only update transaction status based on HTTP Notification orAPI Get Status.
@@ -479,6 +581,8 @@ Under the hood this API wrapper is using [Requests](https://github.com/requests/
479
581
Examples are available on [/examples](/examples) folder.
480
582
There are:
481
583
- [Core Api examples](/examples/core_api)
584
+
- [Subscription examples](/examples/subscription)
585
+
- [Tokenization examples](/examples/tokenization)
482
586
- [Snap examples](/examples/snap)
483
587
- [Flask App examples](/examples/flask_app) that implement Snap & Core Api
# This is just for very basic implementation reference, in production, you should validate the incoming requests and implement your backend more securely.
2
+
importmidtransclient
3
+
importdatetime
4
+
5
+
# Initialize core api client object
6
+
# You can find it in Merchant Portal -> Settings -> Access keys
7
+
core_api=midtransclient.CoreApi(
8
+
is_production=False,
9
+
server_key='YOUR_SERVER_KEY',
10
+
client_key='YOUR_CLIENT_KEY'
11
+
)
12
+
13
+
# To use API subscription for credit card, you should first obtain the 1 click token
14
+
# Refer to this docs: https://docs.midtrans.com/en/core-api/advanced-features?id=recurring-transaction-with-subscriptions-api
15
+
16
+
# You will receive saved_token_id as part of the response when the initial card payment is accepted (will also available in the HTTP notification's JSON)
17
+
# Refer to this docs: https://docs.midtrans.com/en/core-api/advanced-features?id=sample-3ds-authenticate-json-response-for-the-first-transaction
0 commit comments