Skip to content
Advertisement

Set description for Stripe checkout session

I developped the last Stripe module for the end of the year as they ask, but since I put it, I haven’t any more the description and the name of the customer in Stripe.

Do you know how can I put it again ?

This is my code in PHP :

 try { 
    $session = StripeCheckoutSession::create([ 
        'payment_method_types' => ['card'],
        'customer_email' => $email,
        'line_items' => [[ 
            'price_data' => [ 
                'product_data' => [ 
                    'name' => $custom['item_name'], 
                    'metadata' => [ 
                        'pro_id' => $custom['item_name'] 
                    ] 
                ], 
                'unit_amount' => (isset($custom['amountTotal']) ? $custom['amountTotal'] : $custom['amount'])*100, 
                'currency' => $custom['currency_code'], 
            ], 
            'quantity' => 1, 
            'description' => $custom['item_name'], 
        ]], 
        'mode' => 'payment', 
        'success_url' => $url, 
        'cancel_url' => $request->cancel,
        ], ['stripe_account' => $_SESSION['param']->stripeUID]); 
}catch(Exception $e) {  
    $api_error = $e->getMessage();  
} 
 
if(empty($api_error) && $session){ 
    $response = array( 
        'status' => 1, 
        'message' => 'Checkout Session created successfully!', 
        'sessionId' => $session['id'] 
    ); 
}else{ 
    $response = array( 
        'status' => 0, 
        'error' => array( 
            'message' => 'Checkout Session creation failed! '.$api_error    
        ) 
    ); 
} 

And this is what I have now enter image description here

Advertisement

Answer

You should be able to set it here: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-description

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement