douniao8687 2014-03-12 13:40
浏览 52

保护opencart支付回拨功能免受直接访问

i have coded a extension for a Frazy IPG (this ia local payment gateway, not famous at all). In their payment gateway we need to pass the values to their server and they encrypt it and send it to MIGS and when the transaction is success or failed it returns to the my site with the status.

the status values are added to the url when its redirected to my site

if success

index.php?route=payment/frazyiph/callback/&?status=success&message=transaction_success

if failed

index.php?route=payment/frazyiph/callback/&?status=failed&message=invalid_card

these are the only values returned after the payment. so i capture the status and the message from the url and update the database accordingly.

the problem im having is when a person adds a product and directly pastes the success url

index.php?route=payment/frazyiph/callback/&?status=success&message=transaction_success 

it updates as the payment has been made. so i tried capturing the order_id and checking its not empty and update accordingly. The problem was when a person selects to pay at the IPG and cancelled it returns to my page saying the payment is cancelled. and then if someone pastes the success url it updates as the user has paid because the order id has been generated.

is there a way to protect the callback function and make sure the users are redirected from the IPG to my site to update the order and not just typed the url in the address bar?

  • 写回答

1条回答 默认 最新

  • douhao2026 2014-03-12 14:29
    关注

    I do not really understand you, this is the third question you make for a payment module you are developing and thus far i have tried to assist you in each of them, but till now i am not even aware if i helped you, although i see you continue further ahead in the development, some feedback would be greatly appreciated...

    And for your current question there is a way, you need to check the headers with php variables $_SERVER['HTTP_REFERER'] or some other $_SERVER[''] variable should give the necessary information so you can specify that only data that come from IPG are the ones you will accept.

    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计