Setting up subscriptions

Hey,

I am setting up subscriptions on my website using the vanilla integration guide and I am encountering some errors. For reference, my website uses Next.js and React. Here is the code:

   merchantId: 'MyId',
    orderId: orderId,
    orderAmount: 3.99,
    orderCurrency: 'USD',
    recurrence: atlos.RECURRENCE_MONTH,
    userEmail: email,
    userName: username,
    onSuccess: handleSuccess,
    onCanceled: handleCanceled,
    onCompleted: handleCompleted,
    subscriptionId: subId,
    theme: 

Order and subscription ids are both randomly generated (ex. ob4lyrhv851). I have redacted my merchant id.

The issue comes when I select “Pay Manually.” I get a notification at the top saying “Could not create payment.” If I inspect the network tab, I see the following error:

Response: {“ErrorCode”:1003,“ErrorMessage”:“Subscription id ‘p80fjd09cm’ doesn’t exist.”}

Is there something I need to do to create the subscription before the process initiates, or am I making some other mistake?

Thanks.

Hi nahwhat,

You did everything correctly, except you don’t need to use the subscriptionId field at all when creating a new subscription. These IDs are generated by our server, and they have to exist if you pass one. They are only used to apply payments to existing previously created subscriptions.