Environmental requirements
PHP5.0 or above, and curl and openssl need to be turned on.
Document address:
https://doc.open.alipay.com/doc2/detail?treeId=62&articleId=103566&docType=1
E-commerce website payment flow chart
Select demo
即时到账交易接口(create_direct_pay_by_user)
After the demo is downloaded and decompressed, the directory is as follows:
select:MD5签名版本/create_direct_pay_by_user-PHP-UTF-8
We put these files in the web directory pay, and then visit: http://localhost/pay/ and
click "Confirm Payment", ^_^
1. Edit alipay.config.php
In the above configuration, we would just fill $alipay_config['partner']
and $alipay_config['key']
after this two (note must be signed merchant configuration information)
so that we "confirm payment" will jump to http://www.mydev.com/alipayapi.php
, and then jump to Alipay's payment page.
When your payment is completed, a sync notification will be sent, skip back to
Unscheduled asynchronous notification (if the synchronous notification is successful, the asynchronous notification will not be sent)
2. Demo process summary
Step 1: In index.php, build an order information form with the following fields
Step 2: Submit the form to alipayapi.php, and receive parameters in alipayapi.php
Then construct the parameters for requesting Alipay:
Then send a request (to Alipay), and you will be redirected to Alipay’s payment page
Step 3: Send a synchronous notification of payment completion (return_url.php) to the website, and send an asynchronous notification (notify_url.php) to the website from time to time.
return_url.php or notify_url.php, both of which process the verification result
Notify the customer that your order payment is successful/failed. End the entire payment process.