Hi there,
trying to create a payment link with subscription_plan_id
in sandbox, but the payment page looks a one-off payment and after clicking “Test Payment” it also appears just as a one-off transaction in the dashboard, no subscription created. What am I missing?
Request:
content-length: 236
content-type: application/json
square-version: 2023-11-15
accept-encoding: gzip
accept: application/json
user-agent: Square-PHP-SDK/33.0.0.20231115 (2023-11-15) PHP/8.0.30 (Linux-5.15.133.1-microsoft-standard-WSL2)
{
"quick_pay": {
"name": "test sub",
"price_money": {
"amount": 3900,
"currency": "AUD"
},
"location_id": "LH7FXP9W6JWHH"
},
"checkout_options": {
"allow_tipping": false,
"subscription_plan_id": "WEO5SYJ6RZMPEMSISRLMYSG7",
"ask_for_shipping_address": false
}
}
Response:
{
"payment_link": {
"id": "UK5QYERQLQBHIHAT",
"version": 1,
"order_id": "6hMSlvp1oLiMX8lg3daUbPzUpq5YY",
"checkout_options": {
"allow_tipping": false,
"subscription_plan_id": "WEO5SYJ6RZMPEMSISRLMYSG7",
"ask_for_shipping_address": false
},
"url": "https://sandbox.square.link/u/MS2HM5fq",
"long_url": "https://connect.squareupsandbox.com/v2/online-checkout/sandbox-testing-panel/ML61AP0FQMZW1/UK5QYERQLQBHIHAT",
"created_at": "2023-12-01T04:57:51Z"
},
"related_resources": {
"orders": [
{
"id": "6hMSlvp1oLiMX8lg3daUbPzUpq5YY",
"location_id": "LH7FXP9W6JWHH",
"source": {
"name": "Sandbox for sq0idp-VVI-Hb2jI7UGnzqb7smxGQ"
},
"line_items": [
{
"uid": "8NYKsJKOYYIvwAccjzm9w",
"name": "test sub",
"quantity": "1",
"item_type": "ITEM",
"base_price_money": {
"amount": 3900,
"currency": "AUD"
},
"variation_total_price_money": {
"amount": 3900,
"currency": "AUD"
},
"gross_sales_money": {
"amount": 3900,
"currency": "AUD"
},
"total_tax_money": {
"amount": 0,
"currency": "AUD"
},
"total_discount_money": {
"amount": 0,
"currency": "AUD"
},
"total_money": {
"amount": 3900,
"currency": "AUD"
},
"total_service_charge_money": {
"amount": 0,
"currency": "AUD"
}
}
],
"fulfillments": [
{
"uid": "nTUyEwVUbe6wgVgkPaNN5C",
"type": "DIGITAL",
"state": "PROPOSED"
}
],
"net_amounts": {
"total_money": {
"amount": 3900,
"currency": "AUD"
},
"tax_money": {
"amount": 0,
"currency": "AUD"
},
"discount_money": {
"amount": 0,
"currency": "AUD"
},
"tip_money": {
"amount": 0,
"currency": "AUD"
},
"service_charge_money": {
"amount": 0,
"currency": "AUD"
}
},
"created_at": "2023-12-01T04:57:51.244Z",
"updated_at": "2023-12-01T04:57:51.244Z",
"state": "DRAFT",
"version": 1,
"total_money": {
"amount": 3900,
"currency": "AUD"
},
"total_tax_money": {
"amount": 0,
"currency": "AUD"
},
"total_discount_money": {
"amount": 0,
"currency": "AUD"
},
"total_tip_money": {
"amount": 0,
"currency": "AUD"
},
"total_service_charge_money": {
"amount": 0,
"currency": "AUD"
},
"net_amount_due_money": {
"amount": 3900,
"currency": "AUD"
}
}
],
"subscription_plans": [
{
"type": "SUBSCRIPTION_PLAN_VARIATION",
"id": "WEO5SYJ6RZMPEMSISRLMYSG7",
"updated_at": "2023-11-30T06:13:32.193Z",
"created_at": "2023-11-30T06:13:32.193Z",
"version": 1701324812193,
"is_deleted": false,
"present_at_all_locations": true,
"subscription_plan_variation_data": {
"name": "Basic Sub",
"phases": [
{
"uid": "5GYQKWQS5GVE2INNAF34RYSS",
"cadence": "MONTHLY",
"ordinal": 0,
"pricing": {
"type": "RELATIVE"
}
}
],
"subscription_plan_id": "FVU2QWVHAV6KQIN4QA3WKFDG"
}
}
]
}
}
Also, from the docs it looks like when creating a payment link for subscription I have to use quick_pay
and not order.line_items
. Is that right? And I have to specify the amount every time. If so , then what’s the purpose of adding Catalog Items to a subscription Plan?
Thank you!