Payment tokenization extension points
To implement payment tokenization integration, we can create extension code for the following extension points.
Extension point Where the extension point is used Extension code implementation tips Request, Response formats Sample extension code location create_payment_token The add payment instruction operation (POST cart/@self/payment_instruction) or the update checkout profile operation (PUT person/@self/checkoutProfile) calls the create_payment_token extension point to create the payment token. The create_payment_token extension code should call the payment service provider to tokenize the payment information in the protocol data and return the payment token and its display value as the key-value pairs "payment_token" and "display_value" in the token data. CreatePaymentTokenCmdUEInput, CreatePaymentTokenCmdUEOutput The createPaymentToken method in workspace_dir/commerceue-app/src/main/java/com/ibm/commerce/order/ue/rest/PaymentResource.java update_payment_token The update payment instruction operation (PUT cart/@self/payment_instruction) or the update checkout profile operation (PUT person/@self/checkoutProfile) calls the update_payment_token extension point to update the payment token. The update_payment_token extension code should call the payment service provider to re-tokenize the existing token data with the updated payment information in the protocol data and return the updated payment token and its display value as the key-value pairs "payment_token" and "display_value" in the token data. UpdatePaymentTokenCmdUEInput, UpdatePaymentTokenCmdUEOutput The updatePaymentToken method in workspace_dir/commerceue-app/src/main/java/com/ibm/commerce/order/ue/rest/PaymentResource.java remove_payment_token The delete payment instruction operation (DELETE cart/@self/payment_instruction/{piId}) calls the remove_payment_token extension point to remove the payment token. The remove_payment_token extension code should call the payment service provider to remove the payment token (as the key-value pair "payment_token" in the token data) from its database. RemovePaymentTokenCmdUEInput, RemovePaymentTokenCmdUEOutput The removePaymentToken method in workspace_dir/commerceue-app/src/main/java/com/ibm/commerce/order/ue/rest/PaymentResource.java approve_payment The checkout cart operation (POST cart/@self/checkout) calls the approve_payment extension point to authorize payment. The approve_payment extension code should call the payment service provider with the saved token data in the protocol data to process payment and return the updated financial transaction with its state set to 2 (success) or 3 (failed). PaymentApproveCmdUEInput, PaymentApproveCmdUEOutput The createPaymentToken method in workspace_dir/commerceue-app/src/main/java/com/ibm/commerce/order/ue/rest/PaymentResource.java