使用PayPal完成在线支付后如何将美元转换为网站自己的货币并保存

How to convert usd to website's own currency and save after finishing online payment using PayPal

我有一家网店。我的网站上有一个名为 fcoin 的货币。

我正在使用 PayPal 作为支付系统。

我的 mysql 数据库中有一个名为 fcoinvalue 的列。

我的汇率是1USD = 1fcoin

问题:

  1. 是否可以在用户完成交易后使用php or/and检测交易金额并在fcoinvalue列中保存价值javascript?

场景简单:

假设用户需要启用网站高级功能才能在主页上放置广告。如果用户通过 PayPal he/she 存入 10 美元,必须在 网站钱包中看到 10 个 fcoin。

当然有可能。第一步是获取交易金额,这将取决于您如何与 PayPal 集成。一个server integration is preferred for this scenario. You'll need two routes, one for 'Create Order' and one for 'Capture Order'. These routes should return JSON data, so they can be paired with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

捕获成功后,您应该在返回 JSON 响应之前进行检查,如果是这样,请更新您的数据库以记录收到的订单。 (在您的情况下,这显然意味着为用户更新 fcoin 钱包余额。)