Checkout: Request Checkout Endpoint for full documentation
- Similar to the request checkout example, we can use a JSON custom field to add other information for creating a subscription via API. Again, the code is otherinfo.
Here’s an example:
"other_info": [
{
"code": "otherinfo",
"value": {
"order_no": 12345678,
"awb_number": "ABC123",
"delivery_number": "ABC1234"
}
}
]
Here’s how a sample request payload would look like:
{
"data": {
"attributes": {
"payment_type_id": null,
"payor": null,
"billing_address": null,
"billing_barangay": null,
"billing_city": null,
"billing_province": null,
"billing_zip_code": null,
"recipient": null,
"shipping_address": null,
"shipping_barangay": null,
"shipping_city": null,
"shipping_province": null,
"shipping_zip_code": null,
"max_payment_count": null,
"other_info": [
{
"code": "otherinfo",
"value": {
"order_no": 12345678,
"awb_number": "ABC123",
"delivery_number": "ABC1234"
}
}
],
"reference_id": null,
"success_redirect_url": "https://success.url",
"failure_redirect_url": "https://failure.url"
},
"relationships": {
"customer": {
"data": {
"attributes": {
"name": "Customer Name",
"country_id": "175",
"email": "[email protected]",
"mobile_number": "9123456789",
"address": "Address",
"barangay": "Barangay",
"city": "City",
"province": "Province",
"zip_code": "1234",
"other_info": []
}
}
},
"products": {
"data": [
{
"attributes": {
"title": "Test Product",
"description": null,
"quantity": 1,
"payment_schedule": {
"frequency": "monthly",
"day": 1
},
"is_shippable": false,
"are_multiple_orders_allowed": true
}
}
]
}
}
}
}
- After sending the checkout request, a successful response would look like this:
{
"data": {
"id": 8768,
"type": "subscriptions",
"attributes": {
"merchant_id": 202,
"customer_id": 3106,
"payment_type_id": null,
"bank_id": null,
"shipping_method_id": null,
"payor": "Customer Name",
"billing_address": "Address",
"billing_province": "Province",
"billing_country": null,
"billing_city": "City",
"billing_barangay": "Barangay",
"billing_zip_code": "1234",
"recipient": null,
"shipping_address": null,
"shipping_province": null,
"shipping_country": null,
"shipping_city": null,
"shipping_barangay": null,
"shipping_zip_code": null,
"other_info": [
{
"id": 141,
"code": "otherinfo",
"label": "otherinfo",
"value": {
"order_no": 12345678,
"awb_number": "ABC123",
"delivery_number": "ABC1234"
},
"data_type": "json",
"is_visible": false,
"is_required": false,
"merchant_id": 202,
"dropdown_selection": []
}
],
"payment_schedule": null,
"max_payment_count": null,
"last_billing_date": null,
"shipping_fee": null,
"custom_shipping_fee": null,
"bank_fee": null,
"vat_amount": null,
"convenience_fee": null,
"original_price": null,
"total_price": null,
"total_amount_paid": 0,
"reference_id": null,
"success_redirect_url": null,
"failure_redirect_url": null,
"paymaya_wallet_customer_name": null,
"paymaya_wallet_mobile_number": null,
"paymaya_link_id": null,
"paymaya_payment_token_id": null,
"paymaya_verification_url": null,
"paymaya_card_token_id": null,
"paymaya_card_type": null,
"paymaya_masked_pan": null,
"brankas_masked_pan": null,
"is_api_booking": true,
"is_checkout_booking": false,
"completed_at": null,
"cancelled_at": null,
"created_at": "2022-07-26 18:40:46",
"updated_at": "2022-07-26 18:40:46",
"deleted_at": null,
"total_price_updated_at": null,
"is_console_booking": false,
"is_deep_link_checkout": false,
"is_shopify_booking": false,
"is_membership": false,
"is_auto_charge": false,
"delivery_note": null,
"voucher_id": null,
"subscription_import_id": null,
"discord_user_id": null,
"schedule_email_id": null
},
"relationships": {
"customer": {
"data": {
"id": 3106,
"type": "customers"
}
},
"initial_order": {
"data": {
"id": 26679,
"type": "orders"
}
},
"products": {
"data": [
{
"id": 9942,
"type": "subscribed_products"
}
]
}
}
},
"included": [
{
"id": 3106,
"type": "customers",
"attributes": {
"merchant_id": 202,
"shopify_id": null,
"name": "Customer Name",
"email": "[email protected]",
"country_id": 175,
"new_country_id": null,
"mobile_number": "9123456789",
"formatted_mobile_number": "+639123456789",
"new_mobile_number": null,
"address": "Address",
"country_name": null,
"province": "Province",
"city": "City",
"barangay": "Barangay",
"zip_code": "1234",
"viber_info": null,
"other_info": [],
"created_at": "2022-07-26T10:40:46.000000Z",
"updated_at": "2022-07-26T10:40:46.000000Z",
"deleted_at": null,
"is_unsubscribed": false,
"discord_user_id": null,
"discord_user_username": null
}
},
{
"id": 26679,
"type": "orders",
"attributes": {
"subscription_id": 8768,
"payment_type_id": null,
"bank_id": null,
"payment_status_id": 4,
"order_status_id": 2,
"transaction_id": null,
"shopify_order_id": null,
"shipping_method_id": null,
"shipping_fee": null,
"custom_shipping_fee": null,
"bank_fee": null,
"convenience_fee": null,
"vat_amount": null,
"original_price": null,
"total_price": null,
"previous_balance": 0,
"payment_schedule": {
"day": 1,
"frequency": "monthly"
},
"payment_info": null,
"payment_url": null,
"payment_attempts": 0,
"auto_payment_attempts": 0,
"payor": "Customer Name",
"billing_date": "2022-08-01 00:00:00",
"billing_address": "Address",
"billing_province": "Province",
"billing_country": null,
"billing_city": "City",
"billing_barangay": "Barangay",
"billing_zip_code": "1234",
"recipient": null,
"shipping_date": null,
"shipping_address": null,
"shipping_city": null,
"shipping_province": null,
"shipping_country": null,
"shipping_barangay": null,
"shipping_zip_code": null,
"fulfillment_date": null,
"order_number": null,
"paymaya_link_id": null,
"group_number": 1,
"paymaya_card_token_id": null,
"paymaya_card_type": null,
"paymaya_masked_pan": null,
"brankas_masked_pan": null,
"has_payment_lapsed": false,
"paid_at": "2022-07-26 18:40:46",
"shipped_at": null,
"payment_attempted_at": null,
"created_at": "2022-07-26 18:40:46",
"updated_at": "2022-07-26 18:40:46",
"deleted_at": null,
"voucher_code": null,
"fulfilled_at": null,
"payment_initiator_type": null,
"payment_initiator_id": null,
"is_auto_charge": false
}
},
{
"id": 9942,
"type": "subscribed_products",
"attributes": {
"subscription_id": 8768,
"product_id": null,
"product_variant_id": null,
"option_values": null,
"title": "Test Product",
"description": null,
"images": null,
"shopify_custom_links": null,
"payment_schedule": {
"day": 1,
"frequency": "monthly"
},
"max_discounted_order_count": null,
"price": null,
"discounted_price": null,
"total_discounted_price": null,
"quantity": 1,
"total_price": null,
"group_number": 1,
"are_multiple_orders_allowed": true,
"created_at": "2022-07-26 18:40:46",
"updated_at": "2022-07-26 18:40:46",
"is_shippable": false,
"is_membership": false,
"shopify_product_info": null,
"sku_meta_notes": null,
"is_active_discord_member": false
}
}
]
}
- Looking at the created subscription, we can see that the JSON custom field that we sent is displayed on the subscription details.