Checkout

add(function ($request, $response, $next) { \Stripe\Stripe::setApiKey(‘sk_test_51IW8lwJSa3bS1IRdO7pRgWFITevKDFf70jhBQo0l837gDlIxsdvm1xxt6YUJBw8JcjHcj1x0vYxDCkvYXN70K91100sVVO5TRe’); return $next($request, $response); }); $app->post(‘/create-checkout-session’, function (Request $request, Response $response) { $session = \Stripe\Checkout\Session::create([ ‘payment_method_types’ => [‘card’], ‘line_items’ => [[ ‘price_data’ => [ ‘currency’ => ‘usd’, ‘product_data’ => [ ‘name’ => ‘T-shirt’, ], ‘unit_amount’ => 2000, ], ‘quantity’ => 1, ]], ‘mode’ => ‘payment’, ‘success_url’ => ‘https://example.com/success’, ‘cancel_url’ => ‘https://example.com/cancel’, ]); return $response->withJson([ ‘id’ => $session->id ])->withStatus(200); }); $app->run(); Membresía Fan Premium