How to test Creating and Cancelling Subscription in ThriveCart in Test Mode

22 Views Asked by At

I am integrating ThriveCart Checkout For payment in my laravel project. I implemented Creating and Cancelling subscription and I want to do some test.

I think creating subscription seems to succeed. When I click on 'Select this plan' on my web page

enter image description here

it redirects to ThriveCart checkout page and if I confirm the details of payment, I got success in my webhook and also can confirm the purchase in ThriveCart Dashboard.

But when I try to cancel this subscription by using the following code

use GuzzleHttp\Client;

$client = new Client();
$cancel_url = 'https://thrivecart.com/api/external/cancelSubscription?passthrough[type]=cancel';

try{
    Log::info("Canceling subscription plan");

    $res = $client->request(
        'POST',
        $cancel_url,
        [
            'headers' => [
                'Authorization' => 'Bearer ' . $api_key,
                'X-TC-Mode' => $api_mode,
            ],
            'form_params' => [
                'order_id' => $thrivecart_order_id,
                'subscription_id' => $thrivecart_subscription_id
            ]
        ]
    );

I get the following error

"error": "You must provide matching customer IDs."

I think in test mode, the subscription isn't created but not sure. Can anyone explain how to test Subscription in ThriveCart?

0

There are 0 best solutions below