but when i am reading the doc :
/**
* Sets Subscription Plan Id.
* The id of the subscription plan, if there is one.
*
* @maps subscription_plan_id
*/
so where should i guess the ID ?
Because when i am trying to put ID i have error
{"errors":[{"category":"INVALID_REQUEST_ERROR","code":"INVALID_VALUE","detail":"[merchant_token=ML0NMDX8JSNVV] Object `#WEECALLER` of type SUBSCRIPTION_PLAN_VARIATION references an object with token `WEECALLER123456789`, which does not exist. Expected an object of type SUBSCRIPTION_PLAN.","field":"subscription_plan_id"}]}
Did you first create the subscription plan? In the documentation you first create the plan to generate the subscription_plan_id. Then you pass it in when creating the variation.
@Bryan-Square I get what you say. We need to create a Subscription Plan before trying to create a Subscription Plan Variation in order to create a Subscription.
So I’m trying to create a Subscription Plan as described in the docs… but then I found I need to send this array “eligible_category_ids”, and if I left it in blank because I don’t have any, it fails.
Note: It failed with all_items as true (because I wanted to make all items subscribable under this Plan), so I tried again but with all_items as false and it worked. I wasn’t convinced anyways because I wanted to make all the items subscribable, so I tried again with all_items as true and it worked this time…
This flow looks inconsistent and I can’t trust 100% on it, but I’ll take it since Stripe is not working for iOS on my app and I need to make subscriptions purchases available on my app.
@amity Try creating first a Plan Subscription and then create a Plan Variation.
@Bryan-Square There’s still an issue. API won’t let me create a Plan Variation that costs $1, it says it must be greater than $100. How is it possible I cannot reate a Plan Variation less than $100? am I missing something?
Thanks for help, i created my subscription, i will try full process now.
But I still have one issue about card_id, i am using basic payment in JS.
How should I retrieve card_id ? I dont see in response when user submit credit card …
I am trying to link card object to my customer, but during creation card i have this
{“errors”:[{“category”:“INVALID_REQUEST_ERROR”,“code”:“INVALID_CARD_DATA”,“detail”:“Invalid card data.”,“field”:“source_id”}]}
I am following POST /v2/cards - Square API Reference (squareup.com)
$body = new \Square\Models\CreateCardRequest(
Str::uuid()->toString(),
$data['sourceId'],
$card
);
$data[‘sourceId’] is coming from data processPayment request (from front side)
What’s wrong ?
Mmh no, why should i do that ?
I am using test card yes, so i am sending sourceId of this test card.
I want to simulate full process subscription to put this in production for my website.
Our test values are mainly for generating tokens with the Web Payments SDK and walking through various buyer verification scenarios. They don’t work well when being saved on file and charged. If that’s the scenario you need to test we recommend using cnon:card-nonce-ok.