如何在 salesforce 中使用 Apex 在 Square 中创建客户卡?

How to create customer card in Square using Apex in salesforce?

我们需要使用 salesforce 创建客户并将他们的信用卡信息保存在 Square 中,并且我们必须稍后通过 apex 代码(在 salesforce 中)向客户收取费用。因此,为此,我们作为开发人员阅读并理解了 Square API 文档。 阅读此 link https://developer.squareup.com/reference/square/customers-api/create-customer 后,我们能够使用 Square API 从 salesforce 到 square 创建客户。 Square API 文档已准备就绪,易于阅读。 但是当我们开始实现为客户 Square 保存信用卡的功能时,我们陷入了困境,因为在 Square 中 creating/saving 客户卡需要两件事“customer_id”和“card_nonce”。所以我们有客户 ID,因为我们已经使用 salesforce 中的顶点代码在 Square 中创建了客户。但是我们没有“nonce” and the only way to generate the nonce as per Square API documentation is "Square Payment Form" https://developer.squareup.com/docs/payment-form/payment-form-walkthrough, 所以我花了更多时间寻找解决方法,但所有的努力都失败了。我还尝试创建 VF 页面,并将我们在 salesforce 对象中已有的所有客户和卡信息从顶点代码传递到 Square 支付表单,但 JS 没有执行,Square 支付表单仅适用于 JS SDK。

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

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