我的网站包含一个游戏,如果用户想在3级之后继续游戏,我希望他们支付10欧元。我倾向于使用简单的PayPal按钮进行付款。阅读官方PayPal文档后,似乎可以执行以下操作:
$_SESSION['user_id']
唯一标识一个玩家(这是在游戏中登录后,每个用户的信息都存储在数据库中)。$_SESSION['user_id']
点击"立即购买"按钮,提供付款详情和付款。$_SESSION['user_id']
的值。这应该是容易做到的事情,但事实是我完全迷失在PayPal文档中,这对我来说似乎太过分了。我知道,也许我不是最好的开发者。
我认为还应该为这个非常简单的场景做一些代码。
然后,假设用户支付并且PayPal然后调用paypal_ipn.php,哪个POST属性允许我验证给定$_SESSION['user_id']
的用户付费?
答案 0 :(得分:0)
在对PayPal文档进行越来越多的挖掘之后,我在HTML“立即购买”按钮中找到了“自定义”字段。所以答案就是添加
CREATE SEQUENCE MYDICT_SEQ START WITH 1 MAXVALUE 9999999999999999999999999999 MINVALUE 0;
CREATE VIEW mydict
AS
SELECT a.id, a.origterm, a.code, b.replaceterm, b.sysctlang
FROM table1 a LEFT OUTER JOIN table2 b ON a.id = b.id;
CREATE OR REPLACE TRIGGER mydict_io
INSTEAD OF INSERT OR UPDATE OR DELETE
ON mydict
FOR EACH ROW
DECLARE
cnt1 INTEGER := 0;
cnt2 INTEGER;
nid NUMBER;
BEGIN
IF INSERTING OR UPDATING THEN
IF :new.id IS NULL AND INSERTING THEN
nid := mydict_seq.NEXTVAL;
ELSE
nid := :new.id;
IF UPDATING THEN
nid := :old.id;
END IF;
SELECT COUNT (*)
INTO cnt1
FROM table1
WHERE id = nid;
END IF;
IF cnt1 = 0 THEN
INSERT INTO TABLE1 (ID, ORIGTERM, CODE)
VALUES (nID, :new.ORIGTERM, :new.CODE);
ELSIF cnt1 > 0 THEN
UPDATE TABLE1
SET ORIGTERM = :NEW.ORIGTERM, CODE = :NEW.CODE
WHERE id = nid;
END IF;
SELECT COUNT (*)
INTO cnt2
FROM table2
WHERE id = nid AND SYSCTLANG = :new.SYSCTLANG;
IF cnt2 = 0 THEN
INSERT INTO TABLE2 (ID, REPLACETERM, SYSCTLANG)
VALUES (nID, :new.REPLACETERM, :new.SYSCTLANG);
ELSE
UPDATE TABLE2
SET REPLACETERM = :new.REPLACETERM
WHERE id = nid AND SYSCTLANG = :new.SYSCTLANG;
END IF;
ELSIF DELETING THEN
DELETE FROM table2
WHERE id = :old.id AND SYSCTLANG = :old.SYSCTLANG;
SELECT COUNT (*)
INTO cnt2
FROM table2
WHERE id = nid;
IF cnt2 = 0 THEN
DELETE FROM table1
WHERE id = :old.id;
END IF;
END IF;
END;
DECLARE
nid NUMBER;
BEGIN
INSERT INTO mydict (ORIGTERM, CODE, REPLACETERM, SYSCTLANG)
VALUES ('Plant', 'TEST', 'Pflanze', 3);
nid := mydict_seq.currval;
UPDATE mydict
SET REPLACETERM = 'Fabrik'
WHERE id = nid;
UPDATE mydict
SET REPLACETERM = 'Usine', SYSCTLANG = 4
WHERE id = nid;
END;
以PayPal按钮的形式。