Advertisement

paypal支付v2.0 php 代码库

阅读量:

第一步:获取访问令牌:

复制代码
 <?php

    
  
    
 $clientId = '';     // 替换为你的 PayPal Client ID
    
 $clientSecret = ''; // 替换为你的 PayPal Client Secret
    
  
    
 // PayPal API 请求的 URL
    
 $url = "https://api-m.sandbox.paypal.com/v1/oauth2/token";
    
  
    
 // 初始化 cURL
    
 $ch = curl_init();
    
  
    
 // 设置 cURL 请求的参数
    
 curl_setopt($ch, CURLOPT_URL, $url);
    
 curl_setopt($ch, CURLOPT_POST, true);
    
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
 curl_setopt($ch, CURLOPT_USERPWD, $clientId . ":" . $clientSecret);
    
 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Typ

全部评论 (0)

还没有任何评论哟~