duanpanbo9476 2014-01-06 01:34
浏览 69
已采纳

是否有可能创建一个动态的PayPal支付链接?

I'll be serving this via PHP, so it'll be more difficult to hijack. It's a temporary solution that'll be manually reviewed, so I'm not particularly worried about security. But, I was wondering if it's possible to create a link that would work with variables? Something like this:

https://paypal.com/pay?type=link&price=55aud&item=coffee

After thoroughly searching PP's API documentation I can't find anything of the type.

  • 写回答

1条回答 默认 最新

  • douzhuoxia0587 2014-01-06 09:34
    关注

    Of course. You just need to build your string dynamically with PHP. For example, using your link sample, we might end up with something like this:

    $price = 55;
    $item = 'coffee';
    $currency_code = 'aud';
    
    $paypal_url = 'https://paypal.com/pay?type=link&price='.$price.'&currency_code='.$currency_code.'&item='.$item;
    

    Of course, you could use static variables like I did here, or you could load the URL items with session variables, database data, etc. Once the URL is prepared you can output it and attach it to a link, button, simply redirect straight to it, or whatever you need to do.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改