如何在销售队伍中使用 Apex 在 Square 中创建客户卡?

问题描述

我们需要使用 salesforce 创建客户并将他们的信用卡信息保存在 Square 中,我们必须稍后通过 apex 代码(在 salesforce 中)向客户收取付款。因此,为此,我们像开发人员一样阅读并理解 Square API 文档。 阅读此链接 https://developer.squareup.com/reference/square/customers-api/create-customer 后,我们能够使用 Square API 创建从 salesforce 到 square 的客户。 Square API 文档已准备就绪,易于阅读。 但是,当我们开始实施为客户 Square 保存信用卡的功能时,我们陷入了困境,因为在 Square 中创建/保存客户卡时,需要“customer_id”和“card_nonce”两件事。所以我们有客户 ID,因为我们已经使用 salesforce 中的 apex 代码在 Square 中创建了客户。但是我们没有“nonce”What does a Square nonce represent? 并且根据 Square API 文档生成随机数的唯一方法是“Square Payment Form” https://developer.squareup.com/docs/payment-form/payment-form-walkthrough,How to get Nonce for Card using Square API from Backend 所以我花了更多的时间来寻找解决方法,但所有的努力都失败了。我还尝试创建 VF 页面并将我们在 salesforce 对象中已有的所有客户和卡信息从 apex 代码传递到该 Square 付款表单,但 JS 没有执行,Square 付款表单仅适用于 JS SDK。

有没有人知道我们如何从支持的(顶点代码生成“nonce”来为 Square 的客户保存卡片?

解决方法

不使用 Square Payment Form 就无法创建随机数。您也不能将原始数据传递给 Square Payment Form,因为它不包含填写卡数据的功能(邮政编码除外)。有人需要使用托管 Square Payment Form 的 HTTPS 将该信息手动输入到站点中,以便生成合法的