@waffo/waffo-node 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -1
- package/dist/index.d.mts +1027 -974
- package/dist/index.d.ts +1027 -974
- package/dist/index.js +39 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Waffo Node.js SDK
|
|
2
2
|
|
|
3
|
-
<!-- Synced with waffo-sdk/README.md @ commit
|
|
3
|
+
<!-- Synced with waffo-sdk/README.md @ commit ee83ead -->
|
|
4
4
|
|
|
5
5
|
**English** | [中文](README_CN.md)
|
|
6
6
|
|
|
@@ -804,6 +804,113 @@ app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res)
|
|
|
804
804
|
> - `SUBSCRIPTION_STATUS_NOTIFICATION`: When new subscription status changes to `ACTIVE`
|
|
805
805
|
> - `PAYMENT_NOTIFICATION`: If upgrade requires additional payment (price difference)
|
|
806
806
|
|
|
807
|
+
### Webhook Notification Payload Examples
|
|
808
|
+
|
|
809
|
+
The following examples show the actual payload structure for each notification type.
|
|
810
|
+
|
|
811
|
+
#### PAYMENT_NOTIFICATION
|
|
812
|
+
|
|
813
|
+
```json
|
|
814
|
+
{
|
|
815
|
+
"eventType": "PAYMENT_NOTIFICATION",
|
|
816
|
+
"result": {
|
|
817
|
+
"acquiringOrderId": "A2026xxxxxxxxxxxxxxxxxxxx",
|
|
818
|
+
"orderStatus": "PAY_SUCCESS",
|
|
819
|
+
"orderAmount": "109.00",
|
|
820
|
+
"orderCurrency": "USD",
|
|
821
|
+
"finalDealAmount": "109.00",
|
|
822
|
+
"userCurrency": "USD",
|
|
823
|
+
"orderDescription": "Sample Product",
|
|
824
|
+
"orderRequestedAt": "2026-02-28T10:05:58.000Z",
|
|
825
|
+
"orderCompletedAt": "2026-02-28T10:06:10.000Z",
|
|
826
|
+
"orderUpdatedAt": "2026-02-28T10:06:10.000Z",
|
|
827
|
+
"refundExpiryAt": "2026-08-26T23:59:59.999Z",
|
|
828
|
+
"userInfo": {
|
|
829
|
+
"userId": "user@example.com",
|
|
830
|
+
"userEmail": "user@example.com"
|
|
831
|
+
},
|
|
832
|
+
"merchantInfo": {
|
|
833
|
+
"merchantId": "YOUR_MERCHANT_ID"
|
|
834
|
+
},
|
|
835
|
+
"goodsInfo": {
|
|
836
|
+
"goodsId": "goods_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
837
|
+
"goodsName": "Sample Product"
|
|
838
|
+
},
|
|
839
|
+
"addressInfo": {},
|
|
840
|
+
"paymentInfo": {
|
|
841
|
+
"productName": "SUBSCRIPTION",
|
|
842
|
+
"payMethodType": "CREDITCARD",
|
|
843
|
+
"payMethodName": "CC_VISA",
|
|
844
|
+
"payMethodProperties": "{\"cardToken\":\"CARD_TOKEN_XXXXXXXXXXXXXXXXXXXX\",\"cardTransactionType\":\"CIT\"}",
|
|
845
|
+
"payMethodResponse": "{\"maskCardData\":\"XXXX42****XX4242\"}"
|
|
846
|
+
},
|
|
847
|
+
"subscriptionInfo": {
|
|
848
|
+
"subscriptionId": "SC2026xxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
849
|
+
"subscriptionRequest": "sub_req_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
850
|
+
"merchantRequest": "sub_req_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
851
|
+
"period": "1"
|
|
852
|
+
},
|
|
853
|
+
"cancelRedirectUrl": "https://YOUR_DOMAIN/checkout/YOUR_CHECKOUT_ID"
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
#### SUBSCRIPTION_STATUS_NOTIFICATION / SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION
|
|
859
|
+
|
|
860
|
+
These two notification types share the same payload structure:
|
|
861
|
+
|
|
862
|
+
```json
|
|
863
|
+
{
|
|
864
|
+
"eventType": "SUBSCRIPTION_STATUS_NOTIFICATION",
|
|
865
|
+
"result": {
|
|
866
|
+
"subscriptionId": "SC2026xxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
867
|
+
"subscriptionRequest": "sub_req_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
868
|
+
"merchantSubscriptionId": "sub_req_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
869
|
+
"subscriptionStatus": "ACTIVE",
|
|
870
|
+
"currency": "USD",
|
|
871
|
+
"userCurrency": "USD",
|
|
872
|
+
"amount": "109.00",
|
|
873
|
+
"requestedAt": "2026-02-28T10:05:58.000Z",
|
|
874
|
+
"updatedAt": "2026-02-28T10:06:10.000Z",
|
|
875
|
+
"userInfo": {
|
|
876
|
+
"userId": "user@example.com",
|
|
877
|
+
"userEmail": "user@example.com"
|
|
878
|
+
},
|
|
879
|
+
"merchantInfo": {
|
|
880
|
+
"merchantId": "YOUR_MERCHANT_ID"
|
|
881
|
+
},
|
|
882
|
+
"goodsInfo": {
|
|
883
|
+
"goodsId": "goods_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
884
|
+
"goodsName": "Sample Product"
|
|
885
|
+
},
|
|
886
|
+
"productInfo": {
|
|
887
|
+
"periodType": "MONTHLY",
|
|
888
|
+
"periodInterval": "1",
|
|
889
|
+
"currentPeriod": "1",
|
|
890
|
+
"startDateTime": "2026-02-28T10:06:10.000Z",
|
|
891
|
+
"nextPaymentDateTime": "2026-03-28T10:06:10.000Z",
|
|
892
|
+
"description": "Sample Product"
|
|
893
|
+
},
|
|
894
|
+
"paymentInfo": {
|
|
895
|
+
"productName": "SUBSCRIPTION",
|
|
896
|
+
"payMethodType": "CREDITCARD",
|
|
897
|
+
"payMethodName": "CC_VISA",
|
|
898
|
+
"payMethodProperties": "{}"
|
|
899
|
+
},
|
|
900
|
+
"paymentDetails": [
|
|
901
|
+
{
|
|
902
|
+
"period": "1",
|
|
903
|
+
"acquiringOrderId": "A2026xxxxxxxxxxxxxxxxxxxx",
|
|
904
|
+
"orderAmount": "109.00",
|
|
905
|
+
"orderCurrency": "USD",
|
|
906
|
+
"orderStatus": "PAY_SUCCESS",
|
|
907
|
+
"orderUpdatedAt": "2026-02-28T10:06:10.000Z"
|
|
908
|
+
}
|
|
909
|
+
]
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
```
|
|
913
|
+
|
|
807
914
|
## Payment Method Types
|
|
808
915
|
|
|
809
916
|
### payMethodType Reference
|