Update payment form parameters such as amount, currency, and product_id using the partialIntent object and form.update method
Before updating parameters, complete
Guide
Set up the Solidgate payment form with step-by-step instructions for script loading, container mounting, and payment request configuration.
create
your payment form so the form is initialized on the page.
There is no need to call the payment form repeatedly when using multiple tariffs. Request the form once and modify the
amount
,
currency
,
product_id
, or any parameter of the partialIntent object using the form instance’s
update
method.
To update a Payment Form parameter, generate the
Guide
Authenticate with the Solidgate API using merchant credentials, configure request signing, and start processing live payment transactions.
signature
parameter on your backend. This signature verifies the merchant’s request authenticity on the payment gateway server and originates from the partialIntent encrypted String
Backend setup
Firstly, ensure that the backend is prepared. In the example code, the
formUpdate
function is called with fields.
Specifically, this method allows updates only to a predefined list of fields, distinct from those available during initial form creation in the paymentIntent object. Updates are limited to select parameters within the partialIntent object.
It is important to note that attempting to update fields not defined in the allowed list results in an
error
response.
partialIntent object
Expand all
Choose your payment scenario to see the fields it requires.
Description
Order amount in minor units. For example, 1020 means 10 USD and 20 cents. Can be 0 for zero-amount authorization.
Example
1020
Description
Identifier of the predefined product in UUID v4 format.
Example
faf3b86a-1fe6-4ae5-84d4-ab0651d75db2
Description
Customer ID in the merchant’s system.
Example
4dad42f878
Description
Price ID of the predefined product. Use get product prices to obtain it.
Example
faf3b86a-1fe6-4ae5-84d4-ab0651d75db2
Description
Customer ID in the merchant’s system.
Example
4dad42f878
Description
Currency in three-letter code per the
ISO-4217
Wiki
standard.
Example
USD
Description
Order description in your system and for bank processing.
Highly recommended to keep the description brief to improve the clarity of payment processing, ideally not exceeding 100 characters. It is used in the email receipt sent to the customer.
Example
Premium package
Description
Order items in UTF-8 code.
Example
item1, item2
Description
Date of order creation following the ^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$ pattern.
Identifies the marketing or acquisition channel that brought the customer to the transaction.
Example
facebook
Description
Identifies the internal system or flow that triggered the transaction.
Example
main_menu
Description
Metadata is useful for storing additional, structured information about an object, consisting of up to 10 key-value pairs with a validation limit of 380 characters per field.
The callback notification returns an order_metadata from the order in each state.
Example
{"coupon_code": "NY2025", "partner_id": "123989"}
Description
Provide this URL if you want to redirect a customer to your own Success Screen.
If you do not provide the URL, Solidgate directs customers to the Solidgate Success Screen. The Solidgate notification screen is not customizable, but you can define your own success and fail pages during Payment Form initialization with success_url and fail_url.
Example
http://merchant.example/success
Description
Provide this URL if you want to redirect a customer to your own Fail Screen.
If you do not provide the URL, Solidgate directs customers to the Solidgate Fail Screen.
For updating, provide transaction-related information. This information resides in a FormUpdateDTO object, created by invoking the formUpdate function on your API instance.
1
2
3
4
5
6
7
<?phpuseSolidGate\API\Api;$api=newApi('public_key','secret_key');$formUpdateDTO=$api->formUpdate(['JSON payment intent // fill as described in documentation']);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
constsolidGate=require('@solidgate/node-sdk');letapi=newsolidGate.Api("public_key","secret_key");letpartialIntentData={/// fill it as described in documentation
}letformUpdateDTO=api.formUpdate(partialIntentData);constdataToFront=formUpdateDTO.toObject()/// This values should be applied on front end in the following way
constform.update(dataToFront)
packagemainimport("encoding/json""fmt"solidgate"github.com/solidgate-tech/go-sdk")typeUpdateParamsstruct{...}funcmain(){solidgateSdk:=solidgate.NewSolidGateApi("public_key","secret_key")partialIntent:=solidgate.PartialIntent{}// fill in the necessary information for updating as described in the documentation
partialIntentBytes,err:=json.Marshal(partialIntent)iferr!=nil{fmt.Print(err)}formUpdateDto,err:=solidgateSdk.FormUpdate(partialIntentBytes)iferr!=nil{fmt.Print(err)}// ...
}
1
2
3
4
5
6
7
valapi=Api(HttpClient(),Credentials("public_key","secret_key"))valattributes=Attributes(mapOf(// fill as described in documentation
))valformUpdateDTO=api.formUpdate(attributes)
1
2
3
4
5
6
fromsolidgateimportApiClientclient=ApiClient("public_key","secret_key")partial_intent_dict={}# fill as described in documentationresponseDTO=client.form_update(partial_intent_dict)
Step 2. Pass generated data to frontend
The FormUpdateDTO object, returned by the FormUpdateDTO function, is a class instance. Convert it to a plain object for use in frontend code. This conversion is accomplished by calling the
toObject
function on the FormUpdateDTO object, resulting in a plain JavaScript object.
After forming the merchant data and converting it to a plain object, use it in frontend code to update with the partialIntent encrypted String
Partial form update
Update method parameters
Expand all
Description
Encrypted aes-cbc-256 string of JSON request data with random IV (16 bytes) and secret key is the first 32 bytes of the merchant secret key.
Example
E5FKjxw5vRjjIZ....vmG2YFjg5xcvuedQ==
Description
Signature of request.
It allows verifying whether the request from the Merchant is genuine on the payment gateway server.
<template><Payment:merchant-data="merchantData"@ready-payment-instance="onReadyPaymentInstance"/></template><scriptlang="ts"setup>import{defineAsyncComponent}from'vue'import{InitConfig,ClientSdkInstance}from'@solidgate/vue-sdk'constPayment=defineAsyncComponent(()=>import('@solidgate/vue-sdk'))constmerchantData:InitConfig['merchantData']={merchant:'<<--YOUR MERCHANT ID-->>',signature:'<<--YOUR SIGNATURE OF THE REQUEST-->>',paymentIntent:'<<--YOUR PAYMENT INTENT-->>'}functiononReadyPaymentInstance(form:ClientSdkInstance):void{form.update({partialIntent,signature}).then(callbackForSuccessUpdate).catch(callbackForFailedUpdate)}</script>
import{Component}from'@angular/core';import{BehaviorSubject,filter}from'rxjs'import{InitConfig,SdkMessage,MessageType}from'@solidgate/angular-sdk';@Component({selector:'app-root',template:`
<ngx-solid-payment
[merchantData]="merchantData"
(readyPaymentInstance)="formSubject$.next($event)"
></ngx-solid-payment>
`})exportclassAppComponent{formSubject$=newBehaviorSubject<ClientSdkInstance|null>(null)form$=this.formSubject$.pipe(filter(Boolean))merchantData: InitConfig['merchantData']={merchant:'<<--YOUR MERCHANT ID-->>',signature:'<<--YOUR SIGNATURE OF THE REQUEST-->>',paymentIntent:'<<--YOUR PAYMENT INTENT-->>'}update(payload:{partialIntent: string;signature: string;}):void{this.form$.subscribe(form=>form.update(payload).then(callbackForSuccessUpdate).catch(callbackForFailedUpdate))}}
It is very important to handle possible errors, including network errors, in callbackForFailedUpdate
by calling a valid update or init. Otherwise, the form remains unresponsive.
If an invalid parameter exists in the updateIntent request, such as a non-unique product_id, an error occurs.