About calling the Sina payment interface

Source: Internet
Author: User
Tags oauth urlencode

Recently the company has to do a Sina payment interface application.

First you have to confirm that you have successfully applied to apply Appkey and Appsecret.

To call Sina's payment interface, you have to apply for a payment key. These are all ready to be finished. Next call the official Sina interface

interface One: Get_token interface User initiates payment, the application developer calls the Get_token interface, obtains the payment token, the open platform verifies the application related information, verifies that, returns the token value. Note: when applying for a payment function, the application developer needs to fill in the callback address (see Callback interface); When the user pays successfully, the open platform invokes the callback interface to notify the developer of the order payment status. Url:http://api.t.sina.com.cn/pay/get_token.format Request Parameters via an on-line interface

. The
Name of parameter must fill type Description
order_id true string Order ID (in order to avoid duplication, you need to start with a orderid_pre (7-bit) that is the payment ID, the total length must be 16 bits)
Amount true int Transaction amount, Unit: 1--500000 points
desc true string transaction description, up to 50 characters (UrlEncode)
Sign true string Signature Value SIGN=MD5 (order_id|amount|desc|app_secret), ' | ' It's vertical
Source true stringAppkey that is allocated when applying for application, and the unique identity that represents the application when the interface is invoked. (This parameter is not required in the OAuth authorization mode)
If you are submitting OAuth, you do not need to pass the source parameter again. Through this you can not successfully get to your token and order_uid (SINA_UID)
Payment Success
<result><token>***</token><order_uid>***</order_uid></result>			

interface Two: After the payment interface successfully obtains the token, submits the order information to generate the form (form parameter) to the open platform. Open Platform Verify form information, verify through the page to the "Payment page", the user can make payment operation, if the validation does not pass, return the wrong information. Note: before invoking the payment interface, you must first obtain the payment token (that is, call the Get_token interface). Submit the following parameters to the online interface url:http://pay.weibo.com/wb/?c=pay form parameters as post form submission

The The
Name of parameter must fill Type and Range Description
Return_url true string once the payment is successful, "Return to apply" link address. A developer must be delivered to the platform.
order_id true int order number, that is, the order number passed when the token is obtained, the order number is generated by the developer and can be used for reconciliation, customer support, etc.
order_uid true Long pay the user's Sinauid
desc true stringname of the product must be UTF-8 encoded and be done UrlEncode front end for display to the user to see.
Appkey true LongAppkey that is allocated when applying for application, and the unique identity that represents the application when the interface is invoked.
Amount true int Payment amount, Unit score, greater than 0 less than 500000
version true string Interface Version Number (1.0)
Token true string gets by calling the Get_token interface

Then the success will return to
Failure to jump directly to the payment platform home and (http://credits.weibo.com/)
Public partial class sinapay : pagebase     {         private const string keyDict =  "
 
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";         protected void page_load (object sender,  Eventargs e)         {             if  (! Page.IsPostBack)             {                 try                  {                     int amount =
 
 convert.toint32 (request["Amount"]);                      if  (0 == amount)                      {         
               return;                      }                 
    int extraCoin = 0;                      switch  (amount)                      {                         

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.