Events are our way of letting you know when something interesting happens in your account. When an event occurs, we create a new Event object. If you registered a webhook endpoint to receive that event, we send it to your endpoint as part of a POST request.
Attributes
- idstring
- Unique identifier for the object
- objectstring, value is "event"
- A string representing the object’s type. Objects of the same type share the same value.
- createdAttimestamp
- The moment at which the object was created. Measured in milliseconds since the Unix epoch.
- testboolean
- A flag with a value
false
if the object exists in live mode ortrue
if the object exists in test mode. - eventDatahash
- The information related to this event.
- typestring
- The type of the event, see Supported event types.
- versionstring
- The version of the event.
- datahash
- The original object this event relates to. The shape of this depends on the object returned. For example in case of order related events this will be an order object.
Supported event types
Smartpay allows you to subscribe to the following events. You can subscribe to all or choose a subset of events you would like to be notified about.
Object | Event | Event Type |
---|---|---|
Order | The order was authorized | order.authorized |
The order was rejected. If the event is rejected because of a soft decline, the consumer will have the possibility to update his payment method and retry. In that case, the order will have a status of `requires_authorization`. If the event is rejected because of a hard decline, not further action can be taken and the order have a status of `rejected`. | order.rejected | |
The order was canceled | order.canceled | |
Payment (Capture) | New payment created (order captured) | payment.created |
Refund | New refund created (payment refunded) | refund.created |
Token | The token was created | token.created |
The token was approved by the user | token.approved | |
The token was deleted | token.deleted | |
The token was disabled | token.disabled | |
The token was enabled | token.enabled | |
The token was used to create an order | token.used | |
Payout | Payout calculation done | payout.generated |
The payout was paid to your bank account | payout.paid | |
Coupon | New coupon created | coupon.created |
Coupon updated | coupon.updated | |
Promotion Code | New promotion code created | promotion_code.created |
Promotion code updated | promotion_code.updated | |
Merchant user | New user created for your account | merchant_user.created |
User updated their password | merchant_user.password_reset |
Sample events
{
"id": "evt_test_yETRfprzCxFsSJaJZPIENt",
"object": "event",
"createdAt": 1664522079584,
"test": true,
"eventData": {
"type": "order.authorized",
"version": "2022-02-18",
"data": {
"id": "order_test_bA1znhGULw5lROfDTpHChv",
"object": "order",
"amount": 1500,
"createdAt": 1642474233959,
"currency": "JPY",
"discountAmount": 100,
"discounts": ["discount_test_zoA8epgqnvc7sbA4DmtHi3"],
"expiresAt": 1642496117767,
"lineItems": ["li_test_Lj1ofPS7HabmT3i0XsyB4V"],
"metadata": {},
"payments": ["payment_test_Gy2WUjw7mgrHWNj0toWP3H"],
"reference": "my_reference",
"shippingInfo": {
"address": {
"line1": "虎ノ門1-17-1",
"line2": "虎ノ門ヒルズビジネスタワー 15階",
"line3": "string",
"line4": "string",
"line5": "string",
"subLocality": "string",
"locality": "港区",
"administrativeArea": "東京都",
"postalCode": "105-6415",
"country": "JP"
},
"addressType": "home",
"carrierName": "yamato",
"reference": "1234-5678-9123",
"feeAmount": 500,
"feeCurrency": "JPY"
},
"status": "succeeded",
"test": true,
"updatedAt": 1642534233959
}
}
}
{
"id": "evt_test_D2mJ1ZtjNEzrzRR22mDylX",
"object": "event",
"createdAt": 1664522079617,
"test": true,
"eventData": {
"type": "payment.created",
"version": "2022-02-18",
"data": {
"id": "payment_test_Gy2WUjw7mgrHWNj0toWP3H",
"object": "payment",
"amount": 0,
"createdAt": 1642474233959,
"currency": "JPY",
"description": "string",
"lineItems": ["li_test_Lj1ofPS7HabmT3i0XsyB4V"],
"metadata": {},
"order": "order_test_bA1znhGULw5lROfDTpHChv",
"reference": "string",
"status": "processed",
"test": true,
"updatedAt": 1642534233959
}
}
}
{
"id": "evt_test_lwqA1w7vyWXOJ0ImoVHiWL",
"object": "event",
"createdAt": 1664522180654,
"test": true,
"eventData": {
"type": "refund.created",
"version": "2022-02-18",
"data": {
"id": "refund_test_483xwWmZ1bE0GNvZBoek3h",
"object": "refund",
"amount": 1,
"createdAt": 1642474233959,
"currency": "JPY",
"description": "Refund for smartpay order",
"lineItems": ["li_test_Lj1ofPS7HabmT3i0XsyB4V"],
"metadata": {},
"payment": "payment_test_Gy2WUjw7mgrHWNj0toWP3H",
"reason": "requested_by_customer",
"reference": "my_refund_reference",
"status": "succeeded",
"test": true,
"updatedAt": 1642534233959
}
}
}
{
"id": "evt_test_yETRfprzCxFsSJaJZPIENt",
"object": "event",
"createdAt": 1642534233959,
"test": true,
"eventData": {
"type": "token.approved",
"version": "2022-02-18",
"data": {
"id": "paytok_test_zAo001ZRfyjz1F4rMyYPnL",
"object": "token",
"createdAt": 1642474233959,
"metadata": {},
"reference": "my_token_reference",
"status": "active",
"test": true,
"updatedAt": 1642534233959
}
}
}