永久域名18勿进永久域名在线,女人扒开屁股爽桶30分钟,欧美又粗又大又硬又长又爽视频,国产激情久久久久影院老熟女

400-800-9385
網(wǎng)站建設(shè)資訊詳細(xì)

第三方銀行卡支付空中云匯怎么用php對(duì)接支付

發(fā)表日期:2023-08-17 16:13:57   作者來源:劉紅旺   瀏覽:1905   標(biāo)簽:空中云匯    第三方支付    
Airwallex 中文名稱空中云匯 主頁(yè)是做境外VISA信用卡、銀聯(lián)支付等的一個(gè)集成支付接口

空中云匯

公司網(wǎng)址可以搜索空中云匯
 
一.注冊(cè)創(chuàng)建支持api key
 

獲取key


 
 
二.獲取到平臺(tái)登入token
 
    function getToken(){
        $token=session('air_token');
        $config=$this->config();
        $client_id=$config['x-client-id'];
        $api_key=$config['x-api-key'];
       
      if(!$token){
        $curl = curl_init();
        curl_setopt_array($curl, array(
          CURLOPT_URL => 'https://api.airwallex.com/api/v1/authentication/login',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => '',
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_TIMEOUT => 0,
          CURLOPT_FOLLOWLOCATION => true,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => 'POST',
          CURLOPT_HTTPHEADER => array(
            'Content-Type: application/json',
            'x-client-id:'.$client_id.'',
            'x-api-key:'.$api_key.'',
         
          ),
        ));
       
        $response = curl_exec($curl);
 
        $data=json_decode($response,true);
        //dump($data);exit;
            if($data['token']){
                session('air_token',$data['token'],60*30);
                $token= $data['token'];
            }
        }
        return $token;
 
    }
 
三. 通過token 去獲取溝通平臺(tái)創(chuàng)建支付意向訂單
public  function create_order($order)
    {
        $curl = curl_init();
        $token=$this->getToken();
       
        $time=date(DATE_ISO8601);//注意時(shí)間格式必須是DATE_ISO8601
        //dump($time);
       
        curl_setopt_array($curl, array(
          CURLOPT_URL => 'https://api.airwallex.com/api/v1/pa/payment_intents/create',
          CURLOPT_RETURNTRANSFER => true,
          CURLOPT_ENCODING => '',
          CURLOPT_MAXREDIRS => 10,
          CURLOPT_SSL_VERIFYPEER=>false,
          CURLOPT_SSL_VERIFYHOST=>false,
          CURLOPT_TIMEOUT => 0,
          CURLOPT_FOLLOWLOCATION => true,
          CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
          CURLOPT_CUSTOMREQUEST => 'POST',
          CURLOPT_POSTFIELDS =>'{
            "request_id": "'.$order['merchant_order_id'].'",
            "amount": '.$order['amount'].',
            "currency": "CNY",
            "merchant_order_id": "'.$order['merchant_order_id'].'",  
            "return_url": "xxxxxxxxxxx"
          }',
          CURLOPT_HTTPHEADER => array(
            'Content-Type: application/json',
            'Authorization: Bearer '.$token.''
          ),
        ));
       
        $response = curl_exec($curl);
       
        curl_close($curl);
        return  json_decode($response,true);
 
    }
 
return_url:可選 如果你用的支付模式是跳轉(zhuǎn)到空中云付的托管頁(yè)面就要填寫,支付成功后回跳頁(yè)面,這里我們用的是內(nèi)嵌卡片
 

選擇支付方式


    
四、前端設(shè)置支付卡片
<script src="https://checkout.airwallex.com/assets/elements.bundle.min.js"></script>
 
<div class="main-page shopping-main">
  <div class="container clear pay_box">
      <div class="syt-body">
          <div class="t1">Payment amount</div>
          <div class="t3">{$order.order_no}</div>
          <div class="t2">$ {$total_amount}</div>
          <div id="card-container" style="display: none">
            <!-- STEP #3a: Add an empty container for the card element to be injected into -->
            <div id="card"></div>
            <p id="input-error" style="color: red"></p>
            <!-- STEP #3b: Add a submit button to trigger the payment request -->
            <button id="submit" disabled="true">Submit</button>
          </div>
          <!-- Example response message containers -->
          <p id="error"></p>
          <p id="success">Payment successful!</p>
      </div>
  </div>
</div>
 
 
  <script>
    var id="{$payment.id}";
    var client_secret="{$payment.client_secret}"    
    var currency="{$payment.currency}"
    try {
      // STEP #2: Initialize the Airwallex global context for event communication
      Airwallex.init({
        env: 'prod', // Setup which Airwallex env('staging' | 'demo' | 'prod') to integrate with
        origin: window.location.origin, // Setup your event target to receive the browser events message
        intent_id: id,
        client_secret: client_secret,
        currency: currency,
 
        buttonType: 'buy', // Indicate the type of button you want displayed on your payments form. Like 'buy'
        fonts: [
          // Customizes the font for the payment elements
          {
            src:
              'https://checkout.airwallex.com/fonts/CircularXXWeb/CircularXXWeb-Regular.woff2',
            family: 'AxLLCircular',
            weight: 400,
          },
        ],
      });
 
      // STEP #4: Create 'card' element
      const card = Airwallex.createElement('card');
 
      // STEP #5: Mount card element
      const domElement = card.mount('card');
      // STEP #7: Add an event listener to ensure the element is mounted
      domElement.addEventListener('onReady', (event) => {
        /*
       ... Handle event
        */
        document.getElementById('card-container').style.display = 'block'; // Example: show element when it is mounted
        document.getElementById('submit').style.display = 'block'; // Example: show element when it is mounted
        console.log('Element is ready', event.detail);
      });
 
      // STEP #8: Add an event listener to validate element input
      domElement.addEventListener('onChange', (event) => {
        const { complete } = event.detail;
        document.getElementById('submit').disabled = !complete; // Example: only enable button when element input is completed
      });
 
      // STEP #9: Add an event listener to get input focus status
      domElement.addEventListener('onFocus', (event) => {
        // Customize your input focus style by listen onFocus event
        const element = document.getElementById('input-error');
        if (element) {
          element.innerHTML = ''; // Example: clear input error message
        }
      });
 
      // STEP #10: Add an event listener to show input error message when finish typing
      domElement.addEventListener('onBlur', (event) => {
        const { complete } = event.detail;
        const { error } = event.detail;
        const element = document.getElementById('input-error');
        if (element & error) {
          element.innerHTML = error.message || JSON.stringify(error); // Example: set input error message
        }
      });
 
      // STEP #11: Add an event listener to handle errors
      domElement.addEventListener('onError', (event) => {
        const { error } = event.detail;
        document.getElementById('error').style.display = 'block'; // Example: show error
        document.getElementById('error').innerHTML = error.message; // Example: set error message
        console.error('There was an error', error);
      });
    } catch (error) {
      document.getElementById('error').style.display = 'block'; // Example: show error
      document.getElementById('error').innerHTML = error.message; // Example: set error message
      console.error('There was an error', error);
    }
 
    // STEP #6a: Add a button handler to trigger the payment request
    document.getElementById('submit').addEventListener('click', () => {
      document.getElementById('error').style.display = 'none'; // Example: hide error
      document.getElementById('submit').innerHTML = 'Processing...'; // Example: set submitting state
      document.getElementById('submit').disabled = true; // Example: disable button to prevent double submission
 
      Airwallex.confirmPaymentIntent({
        element: Airwallex.getElement('card'),
        intent_id: id,
        client_secret: client_secret,
     
      })
        .then((response) => {
          // STEP #6b: Listen to the request response
          /* Handle confirm response */
          document.getElementById('success').style.display = 'block'; // Example: show success message
          document.getElementById('submit').innerHTML = 'Submit'; // Example: reset button state
          document.getElementById('submit').disabled = true; // Example: reset button state
         
        })
        .catch((response) => {
          // STEP #6c: Listen to the error response
          /* Handle error response */
          document.getElementById('error').style.display = 'block'; // Example: show error message
          document.getElementById('error').innerHTML = response.message; // Example: fill in error message
          document.getElementById('submit').innerHTML = 'Submit'; // Example: reset button state
          document.getElementById('submit').disabled = false; // Example: reset button state
          console.error(`There was an error, ${JSON.stringify(response)}`);
        });
    });
 

 
Id:創(chuàng)建訂單回調(diào)的訂單id
client_secret:創(chuàng)建訂單回調(diào)secret
Currency:支付的貨幣符號(hào)
 
  • 創(chuàng)建webhooks 回調(diào)支付結(jié)果

 

 

 
如沒特殊注明,文章均為方維網(wǎng)絡(luò)原創(chuàng),轉(zhuǎn)載請(qǐng)注明來自http://www.wfcgdy.com/news/6855.html
久草视频新免费| 色欲人妻AAAAAA无码| 妺妺跟我一起洗澡没忍住| 宝贝把奶露出来h| 另类 图片 欧美 小说 校园| 午夜精品久久久久久99热| 邻居少妇太爽了a片无码| 大帝av在线一区二区三区| 1000部啪啪未满十八勿入免费| 女人18毛片a级毛片免费视频| 日本19禁啪啪吃奶大尺度| 免费观看30分钟哔哩哔哩视频| 精品国产亚洲av麻豆| 诱人小峓子5中字巴巴鱼汤饭| 少妇系列之白嫩人妻| 成人国产片女人爽到高潮网站| 色一情一乱一伦一区二区三区| 性妇bbw搡bbbb搡bbbb| 国产黄a三级三级三级看三级| 老师说我考好了就随便我怎样| 女人10处有痣是富贵痣| 马鞍山师范高等专科学校| 蜜桃传媒一区二区亚洲av婷婷| 亚洲精品无码mv在线观看| 国产精品va在线观看无码不卡| 性妇bbw搡bbbb搡bbbb| 国产精品无码v在线观看| 把腿张开被舔得死去活来在线| 色欲av成人片无码网站网| 又粗又大内射免费视频小说| 国产午夜精品一区二区三区漫画| 欧美人与善交大片免费看| 亚洲av无码成人精品区| 狠狠色综合网久久久久久| 强开小娟嫩苞又嫩又紧视频播放| 国产精品久久久久乳精品爆| 西西里的美丽传说在线观看| 制服 中文 人妻 字幕| 欧美bbbwbbwbbwbbw| 丰满熟妇videosxxxxx| 浪荡女天天不停挨cao日常视频|