PayTest.cs 962 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class PayTest : MonoBehaviour
  7. {
  8. public Text text;
  9. public void Test()
  10. {
  11. GetAlipayProductID("com.dashgame.garden.test01", (pid) =>
  12. {
  13. Debug.Log(pid);
  14. AliplayManager.Instance.Init();
  15. try
  16. {
  17. AliplayManager.Instance.Pay(pid, "");
  18. }
  19. catch (Exception e)
  20. {
  21. text.text = e.ToString();
  22. }
  23. });
  24. }
  25. public void GetAlipayProductID(string id, URLRequest.URLRequestCallBackDelegate callback)
  26. {
  27. URLRequestData urlData = new URLRequestData();
  28. urlData.Add("t", 1);
  29. urlData.Add("i", id);
  30. urlData.Add("u", "12315646849845648");
  31. URLRequest.CreateStrURLRequest(true, HttpManager.AlipayIdURL, urlData, callback, URLRequest.Method.POST);
  32. }
  33. }