Skip to content Skip to sidebar Skip to footer

Transaction Failed Authcodes.#400620 (##400620) Try Again

Using the Car Debit product to collect payment is equanimous of iv steps: authority, auto debit, refund, and settlement. This section provides best practices that all involved parties can follow to integrate Auto Debit successfully.

Fields and definitions

terminalType: the merchant final type that the customer uses. Possible values include:

  • WEB: indicates the last is a PC
  • WAP: indicates the terminal is a WAP page
  • APP: indicates the concluding is a mobile app

osType: the merchant mobile operating organisation, including iOS or Android

accessToken: used for customer say-so and auto debit from a specific wallet

refreshToken: used for refreshing the access token when the access token is most to expire

accessTokenExpiryTime: the expiration time of the access token

refreshTokenExpiryTime: the expiration time of the refresh token

authState: an identifier of each customer authorisation, used for anti-tamper

authCode: used for getting the admission token, which is created and returned to the merchant afterwards customer authorisation succeeds

Overall process

The integration process can be illustrated by the following graphic. For the authorization phase, it is suggested to create a table that contains information nearly admission tokens created for each account. When the access token needs to be refreshed or invalidated, the table will be updated accordingly. For the payment and refund phase, it is suggested to create a tabular array that contains data about the transaction. The tabular array will be updated accordingly when the payment or refund activeness proceeds.

In one case the potency is completed, automobile debit payment tin can be performed as long as the access token is valid, without the need to initiate authorization for each payment.

general process.png

Figure 1. Overall process of Auto Debit integration

Details about how to qualify, make a payment, and make a refund are presented in the following sections.

Authorization

During the dominance process, the merchant obtains the user'due south access token past calling the consult and applyToken interfaces. The access token is used past merchants to direct deduct coin from the user'due south account during the payment phase, with no additional operations required for the user to conduct.

Authorization experience

The authorization process tin be initiated by merchants on a PC website, WAP page, or mobile phone app. This video shows the authorization feel for these terminals.

About admission token

For access tokens that are created past consult and applyToken interfaces, the validity period of each token varies for different wallets and users. Earlier the access token expires, the merchant can extend the validity period of the token by using the refresh token, to prevent transactions from declining due to admission token invalidation.

It is suggested to maintain a life-wheel table that contains information about the access token, periodically remember the admission token that is about to expire, and employ the refresh token to refresh the access token.

When a user wants to unbind an access token, the revocation process to invalidate the token can only exist initiated by the merchant. The user cannot unbind the access token directly from the wallet. Therefore, the merchant must integrate the revoke interface.

You tin can read the post-obit sections to become more information about access token creation and management:

  • How to create an access token
  • How to refresh an access token
  • How to invalidate an admission token

Access token creation

Steps to create an access token:

  1. Call the consult interface to obtain the authorisation address (authUrl) of the wallet.
  2. The merchant uses the authUrl to enter the wallet say-so page.
  3. After the user passes the authentication, the wallet is redirected to the merchant URL (authRedirectUrl) with the authcode and authstate fields. Alipay sends the dominance notification to the merchant at the same time, which also contains the authcode and authstate fields.
  4. The merchant checks whether the value of the authstate field in the URL is consistent with that in the consult request.
  5. The merchant uses the authcode field in the applyToken asking, to o btain the access token and refresh token.

Notes :

  • In the preceding steps, authUrl and authcode can exist used only once. If the authorization process fails, the merchant needs to phone call the interface again with an updated value for the authState field in the request. For example, the updated value for the authState field can be made by appending numbers at the end of the previous value, such as authstatexxxx_1.
  • To obtain authcode, two ways are bachelor for the merchant. The user is redirected to the merchant URL afterwards authentication, which contains authcode. Besides, Alipay sends the authorization notification to the merchant, which contains authcode. Nosotros recommended that the merchant calls the applytoken interface according to the potency notification result because a failed redirection might occur. So, the merchant must integrate with the notifyAuthorization interface.
  • The address used to receive the notification can be configured on Alipay Developer Center. You can go to Integration Settings > Notification URL > alipay.ams.authorizations.notify > Edit Notification URL to configure. See the following figure for details.

image

Effigy two. Configure the notification URL

The following figure is an overall process of creating an access token.

图片1.png

Effigy 3. Overall process of creating an access token

  1. Phone call the consult i nterface

Afterwards receiving the user'due south request to bind a wallet, the merchant needs to get t he authority accost of the wallet by calling the consult interface with the following asking URL:

    • Sandbox endpoint: /ams/sandbox/api/v1/authorizations/consult
    • Product endpoint: /ams/api/v1/authorizations/consult

图2.png

Figure 4. The process of calling the consult interface

The following fields demand to be configured properly in the request:

    • request. authRedirectUrl : this indicates the address of the merchant to be redirected to after the wallet dominance is completed. In Auto Debit, the authcode field is contained in the merchant URL. Therefore, it is necessary to ensure that the address can be used for redirection to the merchant side. The following table shows the addresses used for dissimilar concluding types:

Table one. Addresses for different terminal types

Notes:

      • For security reasons, the address must exist an HTTPS address instead of an HTTP address.
      • For the terminal type of app, the acquirer uses a WAP address that can be redirected to a URL scheme, and then the URL scheme can be redirected to the merchant site. In this way, the acquirer does not need to provide different URL schemes for different sub-merchants when calling the consult interface.
    • asking. terminalType and request. osType : These represent the terminal type of the merchant that the user initiates the request. Delight note that these fields do not represent the terminal type of the wallet that the merchant wants to trigger. The details about the fields are as follows:

Table 2. Details nigh the last types and operation organization types

Processing of return values:

    • If no response is returned, you must phone call the interface over again with the same fields as the previous request.
    • If a response is received, response.effect represents the consultation issue of the authorization status:
      • When resultStatus is U, call the interface over again without irresolute the value of authState.
      • When resultStatus is F , check the reason for failure based on the value of resultCode .
      • When resultStatus is S , authUrl is returned in the response. The merchant page needs to be redirected to the wallet dominance page address specified past authUrl .

Note :

response. authUrl is the address of the wallet authority folio, merely due west hen resultStatus is S , this field is returned in the response. The addresses returned for dissimilar terminal types are in different types :

Table three. authUrl for different last types of the merchant

  1. Redirect to the authorization accost

The authorization address is returned by the authUrl field in the response of the consult interface. The merchant uses the value of authUrl to enter the authorization page of the wallet. authUrl tin can be used only one time during one authorization process. If the potency fails, a consult request needs to be initiated once more to get a new authUrl. The way to redirect to the authUrl address differs for different merchant terminal types:

Tabular array 4. The mode to open authUrl for different terminal types

For more information about how to open the authUrl address, come across Client side integration with wallet .

Notes :

    • For the terminal type of app, the corresponding URL needs to be able to open the digital wallet app. Therefore, the merchant needs to open the URL through the system. Do not open up the link in app embedded WebView, container, or middle page.
    • For more data almost the payment terminals each digital wallet supports, see Customer side integration with wallet .
  1. Redirect to the merchant URL

Afterwards passing the authentication in the wallet, the user needs to be redirected to the merchant URL (authRedirectUrl) with the authcode and authstate fields. Alipay sends the authorization notification to the merchant at the aforementioned time, which also contains the authcode and authstate fields. The merchant but needs to use the authcode and authstate fields:

    1. Check whether the value of the authstate field in the URL is consequent with that in the consult asking.
    2. Check whether the authCode field has a value. If the authCode field is empty, the authority fails. If the authCode field is not empty, the value of authCode is to be used for calling the applyToken interface.

If the user does non start the authenticate process or the authentication process fails, the user will non be redirected to the merchant URL or no authCode is contained in the redirection process. Therefore, the merchant cannot obtain the authCode field. If the merchant does not become authCode within a certain menses of time (a suggested time period is xv minutes), the authorization procedure needs to be abased. If the user needs to rebind, the consult interface is to be initiated again by the merchant.

The authorization process from the wallet page to the merchant page has different redirection paths for dissimilar terminal types. The merchant page is specified past the authRedirectUrl field of the consult interface.

Tabular array v. The way to redirect to the merchant page for different terminal types

  1. Authorization asynchronous notification

Subsequently the merchant integrates the notifyAuthorization interface, Alipay sends the user's authorization result to the merchant according to the following rules:

  • If the authorization succeeds, the asynchronous notification is sent to the merchant immediately.
  • If the authorization token is revoked, the asynchronous notification is sent to the merchant immediately.

The following example beneath is a successful authorisation result sent by Alipay:

            {              "authorizationNotifyType ":              "AUTHCODE_CREATED ",              "authState":              "489767958497 ",              "authCode":              "28100113_1631148338197000019ba74",              "resultInfo ": {              "resultCode ":              "SUCCESS ",              "resultMessage ":              "success ",              "resultStatus ":              "S "              } }          

After receiving the asynchronous notification, the merchant needs to render SUCCESS to Alipay immediately. No digital signature is required. This message represents a successful receipt of the authorization notification. The code sample is as follows:

            {    "upshot":{       "resultCode":"SUCCESS",       "resultStatus":"S",       "resultMessage":"success"    } }          

If the merchant doesn't send such a response to Alipay for the asynchronous notification, or the merchant response is not delivered to Alipay successfully due to network reasons, Alipay will automatically resend the asynchronous notification inside 24 hours for up to 8 times or until the correct response is received. The sending intervals are every bit follows:

0 minute, 2 minutes, ten minutes, 10 minutes, i hr, two hours, 6 hours, 15 hours

Fields in the notifyAuthorization request need to be understood correctly:

  • authorizationNotifyType: When the authorisation succeeds, the value of this field is AUTHCODE_CREATED. When the say-so token is revoked, the value of this field is TOKEN_CANCELED.
  • authState: This field is generated past the merchant, which represents the request. This field should be used for validation. The value of this field needs to exist the same every bit that of the authState field in the consult request.
  • authCode: This field can exist used to obtain an access token and refresh token in the applyToken request.
  1. Call the applyToken interface

Afterwards getting the authCode value, the applyToken interface is to be called by the backend system immediately in example authCode expires. T he merchant needs to telephone call the applyToken interface within one minute after obtaining the authCode with the following asking URL:

    • Sandbox endpoint: /ams/sandbox/api/v1/authorizations/applyToken
    • Production endpoint: /ams/api/v1/authorizations/applyToken

图3.png

Figure five. The process of calling the applyToken interface to go an access token

Processing of return values:

    • If no response is returned, yous must call the interface once again with the same fields as the previous request.
    • If a response is received, accept the following actions for each example:
      • response.result indicates the result of calling the applyToken interface:
        • When effect.resultStatus is S , the authorization is successful.
        • When event.resultStatus is U , telephone call the interface once again with the same fields as the previous asking.
        • When result.resultStatus is F , the merchant needs to take corresponding actions according to resultCode . Because the authCode can merely be used once, the merchant needs to telephone call the consult interface again to reinitiate an say-so process.
      • response.accessToken is the access token later on the authorization is completed, which is returned only when effect.resultStatus is S .
      • respon se.accessTokenExpiryTime is the expiration time of the access token. If the merchant uses the access token to initiate payment afterwards the admission token expires, the payment is to be failed.
      • respon se.refreshToken is used to refresh the validity period of the access token before the accessToken expires.
      • response.refreshTokenExpiryTime is the expiration fourth dimension of the refresh token. Normally, refreshTokenExpiryTime is greater than accessTokenExpiryTime to ensure that refreshToken is usable. If the merchant tries to refresh the validity period of the access token afterwards the refresh token expiration time, thither is no guarantee that every wallet will exist refreshed successfully.

Access token refresh

Due to chance control requirements, digital wallets in different countries accept different validity periods for admission tokens. The minimum validity menstruum is i twelvemonth. The post-obit table shows the validity menses of Alipay+ MPP wallets:

Tabular array 6. Access token validity period for unlike wallets

The merchant needs to refresh the admission token before the admission token expires. We propose refreshing the access token at least ten days earlier the access token expiration and so that Alipay technical support team has enough time to take respective actions. Therefore, use the following mechanism to determine the time to initiate the admission token refresh process:

When the electric current engagement is less than 10 days from the appointment specified past accessTokenExpiryTime, telephone call the applyToken interface to refresh the validity period of the access token with the following request URL:

  • Sandbox endpoint: /ams/sandbox/api/v1/authorizations/applyToken
  • Production endpoint: /ams/api/v1/authorizations/applyToken

For wallets with long access token validity periods, such every bit KakaoPay, the same rule applies. Therefore, the applyToken interface will non exist chosen until the preset engagement.

图4.png

Figure 6. The procedure of refreshing the access token

The following fields demand to be configured properly in the request:

  • grantType : The value is REFRESH_TOKEN for the token refresh procedure.
  • refreshToken : T his is a required field. The value of this field is also the value of refreshToken in the response of the applyToken interface when the applyToken interface is called for creating the access token . When using refreshToken to initiate a request, ensure to initiate a call to refresh the token earlier the accessToken expires.

Processing of return values:

  • If no response is returned, you must call the interface again with the same fields equally the previous request.
  • If a response is received, take the following deportment for each instance:
    • response.result indicates the result of calling the applyToken interface:
      • When result.resultStatus is S , the validity period of the admission token is refreshed successfully.
      • When outcome.resultStatus is U , the merchant needs to call the interface again with the same fields as the previous request.
      • When result.resultStatus is F , the merchant needs to take corresponding actions according to resultCode .
    • response.accessToken is the access token after the refresh process is completed, which is returned merely when result.resultStatus is S . Use this value for the auto debit payment process.
    • respon se.accessTokenExpiryTime is the expiration time of the access token after the refresh process is completed.
    • respon se.refreshToken is used to elongate the validity period of the access token before the accessToken expires, which is returned only when result.resultStatus is S .

Notes :

  • Because s ome wallets might update the value of refreshToken subsequently calling the applyToken interface with grantType of REFRESH_TOKEN , t he merchant needs to utilize the latest refreshToken to elongate the admission token validity catamenia.
  • Wallets with a long validity period for the access token do non provide the refreshToken and refreshTokenExpiryTime fields, s uch as Kakaopay.

Admission token invalidation

To initiate the admission token revocation process, the following two means are available:

● The user revokes the access token in the wallet to initiate the authority counterfoil.

● The merchant calls the revoke interface to initiate the authorisation cancellation.

Therefore, the merchant needs to integrate the revoke interface and initiate the access token revocation process for users with the post-obit request URL:

  • Sandbox endpoint: /ams/sandbox/api/v1/authorizations/revoke
  • Production endpoint: /ams/api/v1/authorizations/revoke

图5.png

Figure vii. The process of invalidating the access token

Authorization cancellation notification

Afterwards the user revokes the admission token in the wallet, Alipay volition send an authorization counterfoil notification to the merchant. The following sample shows a canceled authority consequence:

            {              "authorizationNotifyType ":"TOKEN_CANCELED ",              "accessToken ":"28100103_20215703001538122119 ",              "resultInfo ":{              "resultCode ":"SUCCESS ",              "resultMessage ":"success ",              "resultStatus ":"South "              } }          

After receiving the notification, the merchant needs to return SUCCESS to Alipay immediately. No digital signature is required. This message represents a successful receipt of the authorization cancellation notification. The code sample is as follows:

            {              "result":{              "resultCode":"SUCCESS",              "resultStatus":"S",              "resultMessage":"success"              } }          

For more information about the dominance cancellation notification, see the notifyAuthorization API for details.

Processing of render values:

  • If no response is returned, you must call the interface again with the same fields equally the previous request.
  • If a response is received, take the post-obit actions for each case:
    • response.result indicates the result of calling the revoke interface :
      • When result.resultStatus is S , the revocation is successful.
      • When outcome.resultStatus is U , the merchant needs to call the interface over again with the same fields as the previous asking.
      • When issue.resultStatus is F , the merchant needs to take respective actions according to resultCode .

Note :

If the revocation process succeeds, the admission token becomes invalid. If the admission token is still used for the auto debit payment, the payment volition exist failed .

Motorcar debit payment

Afterwards the user completes authority, the merchant tin direct initiate car debit payments with the access token. There is no need to become through the authorization process again for each payment. For motorcar debit payments, the pay, inquiryPayment, notifyPayment and abolish interfaces are required to exist integrated.

Payment flow.png

Effigy 8. Process of initiating the payment, inquiry, and cancellation process

  • The user selects a wallet to initiate the payment. The merchant client obtains the user information, lodge corporeality, and selected wallet, and calls the interface in the merchant server to identify an order. (Step 1)
  • The merchant server calls the Alipay pay interface. (Pace two)
  • Alipay returns the payment result. (Footstep 4)
    • If the value of outcome.resultStatus is South or F , the merchant does non need to initiate the inquiryPayment interface or update the order status when receiving the asynchronous notification. (Step v)
    • If the value of event.resultStatus is U , the merchant needs to update the order status when receiving the asynchronous notification, or initiate the inquiryPayment interface to go the terminal payment issue. (Pace 5)
  • The merchant server obtains the payment result by receiving the notification from notifyPayment and actively calling the inquiryPayment interface. (Step 6)
  • If the merchant wants to abandon the transaction before obtaining the final payment result (SUCCESS or FAIL), the merchant needs to call the cancel interface. If the merchant wants to abandon the transaction when information technology has been paid successfully, the merchant nonetheless needs to call the cancel interface. By calling the cancel interface, the payment status of the merchant and the user will exist kept consistent. (Step 8)
  • The merchant updates the internal gild status and shows the payment result to the user. (Footstep 10)

Payment result inquiry

To obtain the payment consequence, the merchant needs to monitor the asynchronous notification or actively calling the inquiryPayment interface to go the payment outcome. Although a retransmission mechanism exists for the asynchronous notification, the asynchronous notification might not be received due to network problems when the user successfully completes the payment. Therefore, information technology is necessary to actively inquire the payment result with the inquiryPayment interface.

Payment expiration time

For auto debit products, Alipay'southward payment expiration time is 1 minute. The merchant tin can telephone call the inquiryPayment interface in the form of polling to get the final payment issue. The polling fourth dimension needs to be longer than ane minute.

Final payment results

In the response of the inquiryPayment interface, the following statuses indicate the final payment issue:

  • SUCCESS: The payment succeeded.
  • Neglect: The payment failed.
  • CANCELLED: The payment was canceled.

Also the to a higher place-mentioned last payment results, the response might too exist an intermediate status:

  • PROCESSING: The payment is in progress. If this result is returned, the merchant needs to proceed calling the inquiryPayment interface until a concluding payment result (SUCCESS, FAIL, or CANCELLED) is obtained.

Transaction counterfoil

For payment scenarios with a specific transaction closing time of the merchant, for example, a flash sale, hotel reservation, or flight ticket purchase, conform to the post-obit dominion to ensure payment result consistency between the merchant and the user:

When the following weather condition are all met:

  • The merchant does not receive the notification.
  • No last payment outcome is returned for the inquiryPayment interface.
  • The merchant needs to close the transaction in advance before Alipay's payment expiration time (1 minute).

The cancel interface needs to be called to abolish the transaction to avert payment result inconsistency between the merchant and user. As long as the merchant initiates the cancellation request, Alipay volition guarantee that the transaction volition be canceled or refunded. By calling the abolish interface, the transaction will be canceled if the user has not completed the payment, or refunded if the user has completed the payment.

Call the pay interface

Call the pay interface to initiate an auto debit with the following request URL:

  • Sandbox endpoint: /ams/sandbox/api/v1/payments/pay
  • Production endpoint: /ams/api/v1/payments/pay

The following fields need to be configured properly in the request:

  • asking. paymentMethod.paymentMethodId : represents the access token obtained later on the user completes authorization.

Processing of return values:

  • If no response is returned, call the interface again with the same fields as the previous request.
  • If a response is received, take the post-obit actions for each instance:
    • response.result.resultStatus : indicates the effect o f the payment:
      • S : This indicates the payment succeeds.
      • F : This indicates the payment fails. For more than data nigh the reason for failure, run into resultCode .
      • U : This indicates the payment is nonetheless in procedure. In this instance, the inquiryPayment interface needs to be chosen until the value of paymentStatus is SUCCESS, Neglect, or CANCELLED , or until the asynchronous notification is received.
    • response.paymentAmount : This indicates the amount of the payment, which tin can be used for reconciliation.
    • response.paymentCreateTime : This indicates the time when the payment was initiated.
    • response.paymentTime : This indicates the time when the payment is completed. If the payment fails, this field is not to be returned.

Process payment result

To obtain authentic payment results, the merchant must integrate both the asynchronous notification and payment result inquiry services. Considering some wallets might non return any notification when the payment fails, therefore, integrating both the asynchronous notification and payment result research services will ensure the payment result existence obtained from any wallet.

When the payment is complete, the Alipay server sends an asynchronous notification to inform the merchant of the respective payment outcome. However, for some wallets, asynchronous notifications will not be sent when the payment fails. The asynchronous notification likewise does not have a 100% delivery guarantee.

Therefore, it might occur that the user completes the payment but the merchant does not receive the payment result. To avoid this situation, merchants must integrate the payment effect inquiry service to enquire the payment result constantly in a form of polling.

It is suggested to use the asynchronous notification and payment result inquiry services in the following mode:

image

Figure 9. Use both the asynchronous notification and payment upshot research services to get the payment effect

  • The merchant needs to maintain an order table in the database to contain at to the lowest degree 2 fields: the order number and order status.
  • Asynchronous notification: The merchant needs to listen to Alipay'due south asynchronous notifications and make a response upon receiving an asynchronous notification. Then check the guild status in the database:
    • If the social club condition is INIT, update the guild status co-ordinate to the asynchronous notification.
    • If the order status is not INIT, it indicates that the final payment result has been obtained through research and the lodge condition has been updated accordingly. No farther actions need to be taken.
  • Research: The merchant needs to initiate an active inquiry to the payment result in the class of polling. Before each inquiry, the merchant needs to check the guild status in the database:
    • If the lodge status is INIT, initiate an enquiry. Update the order condition in the database if a concluding payment result is obtained, otherwise, continue the polling procedure.
    • If the order condition is not INIT, it indicates that the inquiry procedure has been conducted and a terminal payment event has been obtained and used for updating the order status. No further actions need to be taken.

Payment asynchronous notification

After the merchant integrates the notifyPayment interface, Alipay sends the user'south payment result to the merchant according to the following rules:

• If the payment succeeds, the asynchronous notification is sent to the merchant immediately.

If the payment fails, the asynchronous notification is sent to the merchant after the one-minute Alipay payment expiration time.

• If the user does non pay, the asynchronous notification is sent to the merchant after the 1-minute Alipay payment expiration time.

After receiving the asynchronous notification, the merchant needs to return SUCCESS to Alipay immediately. No digital signature is required. This message represents a successful receipt of the payment notification. The code sample is as follows:

            {    "outcome":{       "resultCode":"SUCCESS",       "resultStatus":"S",       "resultMessage":"success"    } }          

If the merchant doesn't send such a response to Alipay for the asynchronous notification, or the merchant response is not delivered to Alipay successfully due to network reasons, Alipay will automatically resend the asynchronous notification inside 24 hours for upwards to 8 times or until the correct response is received. The sending intervals are as follows:

0 minute, 2 minutes, 10 minutes, ten minutes, 1 hr, ii hours, 6 hours, fifteen hours

Fields in the notifyPayment request need to be understood correctly:

  • notifyType : The value is PAYMENT_RESULT for this example.
  • event.resultStatus : This field indicates the payment result of the order. Possible values include:
  • Due south : This indicates the payment succeeds.
  • F : This indicates the payment fails. The failure reason is indicated in resultCode.

Notation: The value of U, which represents an unknown status, is not used in this interface.

  • paymentRequestId : This field is assigned past the merchant to identify each unique asking.
  • paymentId : The unique ID that is assigned by Alipay to identify a payment.
  • paymentAmount : This field represents the amount that the user paid. The merchant tin can utilize the value of this field for comparison amounts.
  • paymentCreateTime : This field indicates the time that the payment was created
  • paymentTime : This field indicates the fourth dimension that the payment was completed. If the payment was failed to be paid, this field is not returned.

Inquiry

Merchants can initiate the inquiryPayment interface to inquire the payment issue subsequently completing the pay interface calling, or when the payment result notification is non received within 1 minute after receiving the response of the payment asking. The following fields in the inquiryPayment interface need to exist understood correctly:

Fields in request :

  • paymentRequestId: This field is assigned by the merchant to identify each unique asking. It is suggested to use this field for the inquiry procedure.

Fields in response

  • result : This field only indicates the calling condition of this inquiry request. It does not signal the payment status.
  • paymentStatus : This field indicates the payment condition of the order. This field is returned only when the value of result.resultStatus is S . The value of this field tin can exist:
  • SUCCESS : This value indicates the payment succeeds. Equally this is a final payment condition, the merchant can stop the inquiry process.
  • FAIL : This value indicates the payment failed. As this is a last payment status, the merchant can stop the inquiry process.
  • CANCELLED : This value indicates the payment is canceled. As this is a final payment status, the merchant tin stop the research process.
  • PROCESSING: This value indicates that the payment is still processing. This is an intermediate payment condition. When this value is returned, the merchant needs to continue the inquiry procedure in the class of polling until a final payment status is obtained or until the asynchronous notification is received. The polling time needs to concluding for at least 1 minute (Alipay's payment expiration fourth dimension).

Cancel the transaction (if required)

If the merchant deals with payment scenarios that have a specific transaction closing time, the cancel interface must be integrated. The merchant tin can initiate a payment cancellation in one of the following cases:

  • Afterward the payment is successful and inside the cancellable catamenia. There is no fee charged for counterfoil, but the cancellable menstruum is commonly simply 1 day.
  • During the payment process, when the polling process cannot get a final payment event. The merchant can choose to terminate the transaction by calling the cancel interface to keep the transaction status consistent betwixt the user and merchant sides.

The following fields in the cancel interface need to be understood correctly:

Fields in request :

  • paymentRequestId : This field is assigned by the merchant to identify each unique request. It is suggested to employ this field for the counterfoil process.

Fields in response

  • result.resultStatus : This field indicates the counterfoil result:
  • South : This value indicates that the cancellation succeeded.
  • F : This value indicates that the counterfoil is failed. Take farther actions according to resultCode .
  • U : This value indicates that the cancellation result is unknown. Apply the same asking parameters to retry the cancellation asking. If the merchant calls the cancel asking calling three times and withal gets U , contact Alipay Technical Support.
  • paymentId : This field is assigned past Alipay to identify each unique request.
  • paymentRequestId : This field is assigned by the merchant to identify each unique request.
  • cancelTime : The time when the payment cancellation succeeds.

Refund

For transactions that are successfully paid, the merchant can initiate a refund by calling the refund interface or manually initiate a refund through the merchant's dorsum-end. The refundable period is adamant past the contract, which is normally 12 months. The request URL is ane of the following options:

  • Sandbox endpoint : /ams/sandbox/api/v1/payments/refund
  • Product endpoint : /ams/api/v1/payments/refund

图片1.png

Effigy 10. Refund process

Processing of return values:

  • If no response is returned, you must telephone call the interface again with the same fields as the previous request.
  • If a response is returned, the value of response.result.resultStatus bespeak due south the refund status:
    • S: This indicates the refund succeeds.
    • U: This indicates the refund is in an uncertain condition. You must phone call the interface again with the same fields as the original request. You can call the refund interface again with the same fields equally the original request or call the inquiryRefund interface to obtain the final condition of the original refund request.
    • F: This indicates that the refund fails. Further actions that needs to be taken are indicated by the resultC ode field. For instance, if a result lawmaking of MERCHANT_BALANCE_NOT_ENOUGH is returned, information technology indicates that the balance of the merchant to be settled is insufficient. That is, the balance of the merchant to be settled is less than the refund amount. Therefore, the merchant needs to wait until successful payments are generated and the balance of the merchant to be settled is greater than the refund corporeality of the transaction, then initiate the refund process again. When reinitiating the refund process, the value of asking.refundRequestId must be updated.
  • response.refundAmount: indicates the refund corporeality, which can be used for reconciliation.

Note :

The difference between the activity of refund and the action of canceling a transaction:

  • T he refundable and cancellable period are specified by the contact. By default, the refundable menstruation is 12 months and the cancellable flow is 1 day.
  • Fees volition be charged for the refund process, while there are no fees to cancel a transaction.
  • The refund process can be used simply for a successfully paid transaction. The counterfoil process is used for a transaction that does not receive a final payment result of success or failure and is used when the merchant needs to abandon the transaction.
  • The refund procedure supports fractional refund of the transaction, while the counterfoil process cancels the entire transaction.

About the payment corporeality and currency

Currency-related information fields exist for both APIs and reconciliation reports. One of them is the payment amount that is presented past the amount field. The amount field has subfields of currency and value. And all currency fields of Alipay APIs or reports follow the same definition.

Corporeality

Table seven. Subfields of the amount field.

Note:

The actual value in the value field of the amount field is represented in the smallest unit of the currency. Alipay follows the ISO 4217 standard for the definition of the smallest unit of a currency.

Smallest unit of measurement for different currencies

Table 8. Details about the currency.

Minimum payment or refund amount

The minimum payment or refund amount differs for each wallet. The following table shows the details of the minimum payment or refund amount of each wallet.

Tabular array 9. The minimum payment or refund amount for different wallet.

pepperlifuld.blogspot.com

Source: https://global.alipay.com/docs/ac/agreementpayment/autodebit_bp

Post a Comment for "Transaction Failed Authcodes.#400620 (##400620) Try Again"