#Vinny GG

1 messages · Page 1 of 1 (latest)

rugged swallowBOT
wanton fiber
#

Hi 👋

What do you mean by that?

edgy sparrow
#

This link only shows how signature recreation can be done. Do you have some docs on how this can be done using your API?

#

I'm doing the code in php

wanton fiber
#

AFAIK we don't have an API to handle that. You would want to reach out to Support and get to our Billing Migrations team

edgy sparrow
#
            config('settings.billing.stripe_secret')
        );

        $stripeNew = new \Stripe\StripeClient(
            config('settings.billing.stripe_secret_eua')
        );

        foreach ($stripeOld->subscriptions->all()['data'] as $billing) {

            $metadata = json_encode($billing['metadata']);  
            $metadata = json_decode($metadata, true);
            $itemsData = json_encode($billing['items']);
            $itemsData = json_decode($itemsData, true);
 
            foreach ($itemsData['data'] as $key => $item) {

                $priceData['price_data'] = [                    
                        'currency' => $item['price']['currency'],
                        'product' => $item['price']['product'],
                        'recurring' => [
                            'interval' => $item['price']['recurring']['interval'],
                            'interval_count' => $item['price']['recurring']['interval_count'],
                        ]
                    ];

                if($item['price']['unit_amount'])
                    $priceData['price_data']['unit_amount'] = $item['price']['unit_amount'];
                          
                $items[$key] = [
                        $priceData,
                ];
            }

            $dataSubscription = [
                'customer' => $billing['customer'],
                'currency' => $billing['currency'], 
                'items' => $items,
                'metadata' => $metadata,
                'cancel_at_period_end' => $billing['cancel_at_period_end'],
                'collection_method' => $billing['collection_method'],
                'default_tax_rates' => $billing['default_tax_rates'],   
            ];
            if($billing['transfer_data'])
                $dataSubscription['transfer_data'] = $billing['transfer_data'];

            if($billing['trial_end'])
                $dataSubscription['trial_end'] = $billing['trial_end'];
       
            $newSubscriptionItem = $stripeNew->subscriptions->create([
                 $dataSubscription
             ]);

            foreach ($stripeOld->subscriptionItems->all(['subscription' => $billing['id']])['data'] as $billingItem) {
             // here create new subscription item
            }
        }
    }```
#

I'm looking for the signature of the old account and creating a new signature, correct?

#

Only people from the migration team have this information?

wanton fiber
#

I'm not sure what you mean by signature in this case. What API object and property does this correspond to?

edgy sparrow
#

I'm sorry I mean subscriptions

wanton fiber
#

Oh, that is entirely different then

#

What are you trying to do with subscriptions?

edgy sparrow
#

recreate them for new account

wanton fiber
#

We recommend working with our migrations team rather than using the APIs. This ensures you don't have to recollect all your customer's payment information.

edgy sparrow
#

Okay how could I contact them?

wanton fiber
edgy sparrow
#

tanks