Square API and ColdFusion

我的未来我决定 提交于 2019-12-24 08:02:16

问题


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?


回答1:


Here is a gist another developer has used

<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>


来源:https://stackoverflow.com/questions/44836797/square-api-and-coldfusion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!