Square API和ColdFusion [英] Square API and ColdFusion

查看:111
本文介绍了Square API和ColdFusion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用一个现有的ColdFusion网站,该网站当前使用授权来处理卡。我想切换支付网关并使用Square。是否有人有示例样本如何使用Square API作为支付网关的ColdFusion代码?

I am trying to take an existing ColdFusion website that currently uses Authorize to process cards. I would like to switch over the payment gateway and use Square. Does anyone have any sample ColdFusion code on how to use the Square API as a payment gateway?

推荐答案

这是另一个开发人员使用的要旨

<cfset IDKey = CreateUUID()>
<cfset request.params.card_nonce = form.nonce>
<cfset request.params.amount_money.amount = 100>
<cfset request.params.amount_money.currency = 'USD'>
<cfset request.params.idempotency_key = IDKey>
<cfset jsonString = serializejson(request.params)>
<cfset requestPath = "https://connect.squareup.com/v2/locations/<replace_locationid>/transactions">
<cfhttp url="#requestPath#" method="post" result="response">
    <cfhttpparam type="HEADER" name="Accept" value="application/json">
    <cfhttpparam type="HEADER" name="Content-Type" value="application/json">
    <cfhttpparam type="HEADER" name="Authorization" value="Bearer <replace_access_token>">
    <cfhttpparam type="body" name="params" value="#jsonString#">
</cfhttp>

这篇关于Square API和ColdFusion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆