In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to develop face-to-face bar code payment and code scanning payment in Alipay payment? in view of this problem, this article introduces the corresponding analysis and answer in detail. I hope it can help more partners who want to solve this problem to find a more simple and easy way.
Introduction of bar code payment and QR code payment
1. Bar code payment
Bar code payment is a collection method that Alipay gives to offline traditional industries. Merchants use barcode identification equipment such as code-scanning guns to scan the bar code / QR code on users' Alipay wallets to complete the collection. The user only needs to show the payment code, and all collection operations are completed by the merchant. The usage scenarios are as follows:
Business processes:
Steps to use:
Users log in to Alipay Wallet, click "payment" on the home page, and enter the payment code interface.
The cashier operates in the merchant's cashier system to generate an order, and the user confirms the payment amount.
After the user presents the "payment code" of the wallet, and the cashier uses the code scanning device to scan the bar code / QR code on the user's phone, the merchant's cashier system submits the payment.
After the payment is successful, the merchant's cashier system will get the result of success or failure of payment.
two。 Scan the code to pay
Code scanning payment refers to the mode in which users turn on the "scan" function in Alipay wallet, scan the QR code displayed by merchants in a cashier scene and make payment. This model is suitable for offline physical store payment, face-to-face payment and other scenarios.
The usage scenarios are as follows:
Business processes:
Steps to use:
Users log in to Alipay Wallet, click "pay-scan Code payment" on the home page, and enter the scan interface.
The cashier operates in the merchant's cashier system to generate Alipay orders, and the user confirms the payment amount and generates a QR code.
Users use the "scan code payment" of the wallet and scan the QR code provided by the cashier to confirm the payment.
After the user pays, the merchant cashier system will get the result of success or failure of the payment.
II. Interface application
After applying for enterprise Alipay, the enterprise applies for the function and signs the contract, and then applies as follows in Ant Financial Services Group's open platform (the detailed process is omitted)
Then in the list of features, apply for this function in person, after the application is successful, as follows.
In this way, we have the right to pay in person.
III. Key generation
In Alipay's face-to-face interface, asymmetric encryption algorithms are used, and merchants' own public and private keys need to be generated manually using OpenSSL. If you are unfamiliar with these concepts, please learn about cryptography first. OpenSSL can also be found in the Fangbi Studio blog.
Download the official key generation tool OpenSSL provided by Alipay, and then execute the following command to generate public and private keys.
Among them
Genrsa-out rsa_private_key.pem 1024
Is used to generate the RSA private key. After execution, a file rsa_private_key.pem is generated in the program directory, which contains the following contents
-BEGIN RSA PRIVATE KEY-
MIICXAIBAAKBgQCyffRONGd8Q/1kRh2cpsSRi360DXLHI7zxdPJGYe5HKDWF7u9b
3zZU9erZpM90XE7gZRKsxIgOurH4uqhmVRbto3e+LiYOyNpd6As3Q427KCTIT7aj
HHicZ6GWhegTUiVLqiuWLsauQcbI6DO4GEZrlvAdzus0WcJiJOxW02rxSQIDAQAB
AoGAXBJYyVaC4zj3Jph8YOStlR5N13bwdATdW/glWWT+0rnNEi90TQHRNvY7lNVN
JgrPrTS182TVgjOPxmwSnebakhIuGIdPq99GLE4LGd5lKWTzkd84BMvhatfNsCCz
CEVFqKg3tZd4t3fQ93FrILsnnZpLhiW53jIrStCkR3rx9OECQQDWMSHyc91hEVMQ
QVNasbGEicKWxhoDqjdm2lHkBx4mrB9JEZFDs6MxWdajf2/Qw+tgtpN3YBcCDw/H
NGHhQtStAkEA1VTyjOdAwWode8X4fu0IPq9+E19mcVOAJjLBH46mropwgOdj3raq
T/ThaKeaydjabsTAiY2J18HiTiyH+1bGjQJBAKgRJXH5OFxSG7uXIbCofYJiFi34
G7EcfxxVcqxaaW4u4N2Uy0c0TXkL5T+lXzeQg8D/gfbJj0QuTVNzgdofdoECQBHY
OznCFk6Xe8PguXqUhT4JG/iu4DjWjT+kuzbSjerHtcVylY4JpZFuoHRKoM4Fj6/4
UUqwRjmABFgZrX4+sfkCQCNI8RCZ6yprh6kEOePo3uazAlNENP8dKkhgqChawdK7
7NzlJ727Nt23STHFx6NkhzyruJGQ5Vx1Lkl0wKuKbXM =
-END RSA PRIVATE KEY-
Command
Rsa-in rsa_private_key.pem-pubout-out rsa_public_key.pem
Is used to generate the RSA public key. After execution, a file rsa_public_key.pem is generated in the program directory, which contains the following contents
-BEGIN PUBLIC KEY-
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyffRONGd8Q/1kRh2cpsSRi360
DXLHI7zxdPJGYe5HKDWF7u9b3zZU9erZpM90XE7gZRKsxIgOurH4uqhmVRbto3e+
LiYOyNpd6As3Q427KCTIT7ajhHicZ6GWhegTUiVLqiuWLsauQcbI6DO4GEZrlvAd
Zus0WcJiJOxW02rxSQIDAQAB
-END PUBLIC KEY-
The generated RSA public key needs to be entered into the application with the address shown below. The private key does not need to be filled in the configuration and will be configured in the code at that time.
Pay special attention to the key to remove the comment part and convert it into a line of characters, otherwise enter line feeds will also become part of the key, which will lead to normal encryption and decryption.
At the same time, you can click "View Alipay Public key" to copy and save Alipay's public key, which will be needed in later programs.
4. Key generation API and key configuration
Common parameter
Request address:
Environment HTTPS request address formal environment https://openapi.alipay.com/gateway.do
Common request parameters:
Whether the parameter type is required. The maximum length description app_idString is 32. The application assigned to developers by Alipay IDmethodString is 128API name formatString No 40 only supports JSONcharsetString is the encoding format used by 10 requests. For example, sign_typeString such as utf-8,gbk,gb2312 is the type of signature algorithm used by 10 merchants to generate signature strings. Currently, RSAsignString is supported as the signature string of 256merchant request parameters. For more information, please see the signature timestampString is the time to send the request. The format "yyyy-MM-dd HH:mm:ss" versionString is the interface version of 3 calls, which is fixed as: 1.0notify_urlString No 256Alipay server actively notifies merchants of the specified page http/https path in the server. App_auth_tokenString No 40 for more information, please see Application Authorization Overview. Biz_contentString is a collection of request parameters with unlimited length. All request parameters except common parameters must be passed in this parameter. For more information, please refer to the request parameters for quick access to documents of each product.
Whether the parameter type is required. The maximum length description out_trade_noString must be 64 merchant order number, less than 64 characters, and can contain letters, numbers and underscores. Need to ensure that the merchant must not repeat sceneString payment scenario barcode payment. Value: bar_code sound wave payment, value: wave_codeauth_codeString must 32 payment authorization code seller_idString optional 28 if this value is empty, then default to the merchant signed account corresponding to Alipay user IDtotal_amountPrice optional 11 order total amount, unit is yuan, discountable_amountPrice can choose 11 to participate in the amount of discount calculation Unit is yuan undiscountable _ amountPrice optional 11 do not participate in the discount calculation amount, unit is yuan subjectString must be 256order title bodyString optional 128order description goods_detailGoodsDetail [] optional-list of items contained in the order, Json format For other instructions, please see the commodity details: operator_idString optional 28 merchant operator number store_idString optional 32 merchant store number terminal_idString optional 32 merchant machine terminal number alipay_store_idString optional 32 Alipay shop number extend_paramsExtendParams optional-business expansion parameter timeout_expressString optional 6 the latest payment time allowed for this order, the transaction will be closed after the expiration of the time limit. royalty_infoRoyaltyInfo optional-describe the sharing information in Json format. For more information, please see sub_merchantSubMerchant optional-second-tier merchant information. This field is currently used only for specific scenarios of special banking institutions. Common response parameters
Whether the parameter type is required. The maximum length description codeString is-gateway error code. For more information, please see document msgString Yes-Gateway return code description. For more information, please see document sub_codeString No-Service return Code, document sub_msgString No-Service return Code description, document signString Yes-signature, and document response parameters.
Parameter type maximum length description trade_noString required 64 Alipay transaction number out_trade_noString required merchant order number 100 buyer Alipay account total_amountPrice required 11 transaction amount receipt_amountString 11 paid-in amount buyer_pay_amountPrice optional 11 buyer's payment amount point_amountPrice optional 11 use of credit payment invoice_amountPrice optional 11 can be issued to the user in the transaction Invoice amount gmt_paymentDate must fill in 32 transaction payment time fund_bill_listTradeFundBill [] required-funds channel used for transaction payment card_balancePrice option 11 payment treasure card balance store_nameString option 512 merchant store name buyer_user_idString required 28 buyer in Alipay user iddiscount_goods_detailString required-commodity discount information of coupon discount used in this transaction payment
The configuration in the system is as follows
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.