我需要在我的php代码中实现BeanStream支付网关。我是支付网关实现的新手。任何人都可以帮助我处理任何演示项目或脚本吗?事先谢谢。需要Beanstream支付网关集成的脚本
2
A
回答
2
我知道这是一个老问题,但因为我只是在我的代码实现的Beanstream支付网关,我想我会回答反正备案:
一旦你有Beanstream一个帐户,你就可以访问他们的API手册,这些手册提供了关于所有请求和响应字段的良好文档。您可以使用PHP中的curl库很容易地连接到Beanstream API。这里是一个基于他们的文档进行简单付款的示例方法($ global_ccauth只是一个ORM对象,它包含我的请求信息,每次存储在我的数据库中,包括来自Beanstream的响应字符串,但是请小心,并且您可能会想混淆信用卡号码在ORM模型之前,它被保存到数据库中,像我这样做):
public static function do_payment($global_ccauth, $submitted_card_number) {
$payment_result = array(
'status' => FALSE,
'response' => array(),
);
// attempt to process the payment using CURL and a POST request to the Beanstream server as per Beanstream's example
$request = curl_init();
// Get curl to POST
curl_setopt($request, CURLOPT_POST, 1);
curl_setopt($request, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // return the results instead of echoing them
curl_setopt($request, CURLOPT_URL, BEANSTREAM_URL);
// These are the transaction parameters that we will POST
$auth_parameters = "requestType=BACKEND";
$auth_parameters .= "&merchant_id=" . BEANSTREAM_MERCHANT;
$auth_parameters .= "&username=" . BEANSTREAM_API_USER;
$auth_parameters .= "&password=" . BEANSTREAM_API_PASS;
$auth_parameters .= "&trnCardOwner=" . $global_ccauth->trnCardOwner;
$auth_parameters .= "&trnCardNumber=". $submitted_card_number;
$auth_parameters .= "&trnExpMonth=" . $global_ccauth->trnExpMonth;
$auth_parameters .= "&trnExpYear=" . $global_ccauth->trnExpYear;
//$auth_parameters .= "&trnCardCvd=";
$auth_parameters .= "&trnOrderNumber=" . $global_ccauth->trnOrderNumber ;
$auth_parameters .= "&trnAmount=" . $global_ccauth->trnAmount;
$auth_parameters .= "&ordName=" . $global_ccauth->ordName;
$auth_parameters .= "&ordEmailAddress=" . $global_ccauth->ordEmailAddress;
$auth_parameters .= "&ordPhoneNumber=" . $global_ccauth->ordPhoneNumber;
$auth_parameters .= "&ordAddress1=" . $global_ccauth->ordAddress1;
$auth_parameters .= "&ordAddress2=" . $global_ccauth->ordAddress2;
$auth_parameters .= "&ordCity=" . $global_ccauth->ordCity;
$auth_parameters .= "&ordProvince=" . $global_ccauth->ordProvince;
$auth_parameters .= "&ordPostalCode=" . $global_ccauth->ordPostalCode;
$auth_parameters .= "&ordCountry=" . $global_ccauth->ordCountry;
curl_setopt($request, CURLOPT_POSTFIELDS, $auth_parameters);
// Now POST the transaction. $txResult will contain Beanstream's response
$auth_result = curl_exec($request);
curl_close($request);
if ($auth_result !== FALSE) {
// save the raw results
$global_ccauth->response = $auth_result;
$global_ccauth->save();
// parse the results
parse_str($auth_result, $parsed_result);
$payment_result['response'] = $parsed_result;
if (! empty($parsed_result['trnApproved']) && $parsed_result['trnApproved'] == 1) {
// the request was approved
$payment_result['status'] = TRUE;
} else {
// the request was not approved
// do something smart
}
} else {
// curl POST request failed
// do something smart
}
return $payment_result;
}
我也实施了定期付款用于自动处理每月支付,它似乎运作良好。您只需根据API文档调整您发送的参数即可。
0
PHP支付似乎是你正在寻找的http://payments.calvinfroedge.com/
相关问题
- 1. 我需要帮助将支付网关集成到网站
- 2. Billdesk支付网关集成
- 3. DPS支付网关集成
- 4. Woocommerce支付网关集成
- 5. paypal支付网关集成
- 6. Interswitch支付网关集成
- 7. Ogone支付网关集成?
- 8. LawPay(支付网关)集成
- 9. 支付网关集成
- 10. payumoney支付网关集成
- 11. satchmo:ccavenue支付网关集成
- 12. 需要帮助在Nihao支付网关集成
- 13. 支付网关与VPC的Lambda集成
- 14. 与Zencart的支付网关集成
- 15. Android的支付网关集成
- 16. Opencart中的支付网关集成
- 17. 买方支付应用程序的PHP支付网关集成
- 18. 用java Instamojo支付网关集成
- 19. 支付网关集成在iPhone
- 20. Ogone支付网关集成php
- 21. 使用PHP EBS支付网关集成
- 22. 将支付网关与IONIC集成
- 23. 在android中集成ccavenue支付网关
- 24. 支付网关集成在java
- 25. Payzippy支付网关集成在Asp.net
- 26. WePay支付网关集成在PHP
- 27. 在ASP.NET中集成支付网关
- 28. Skrill支付网关集成在Android中
- 29. 支付网关集成 - Javascript不工作
- 30. 集成支付网关与导轨
你能详细说明 - 你有没有搜索过一点?你有尝试过什么吗? –
我的网站有购物车信用卡功能。客户提供了Beanstream的merchat帐户API密钥,API密码和签名。我已经搜索了整合脚本。但我找不到。任何人都可以帮助脚本吗? – user1107906