stripe paymentlink支付模式,

他的模式是最新的,所有需要下载最新的sdk插件,通过composer安装后就可以按照以下步骤就使用了

function Stripepaymentlink(){
        require 'vendor/autoload.php';
        $stripe = new \Stripe\StripeClient($privateKey);

        $productid = $stripe->products->create([
          'name' => 'product name',
        ]);
        
        $price = $stripe->prices->create(
          ['currency' => $currency, 'unit_amount' => $amount*100, 'product' => $productid->id]
        );
        
        $checkout = $stripe->paymentLinks->create(
          ['line_items' => [['price' =>$price->id, 'quantity' => 1]],
          'after_completion' => [
              'type' => 'redirect',
              'redirect' => ['url' => $success_uri],
            ],
            
          ]
        );        
        
 	        
        

        if(!empty($checkout)){

		        
		    	echo "<script>window.location.href='".$checkout->url."';</script>";


		}
    }  

更多推荐

PayPal/Stripe/Square轮询收单系统 stripe paymentlink支付模式