Update amount, currency, and product_id with partialIntent and form.update, or replace Billing checkout line items with form.updateCheckout
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.
An initialized form supports two update methods. Use
update
with partialIntent to change
amount
,
currency
, or
product_id
. Use
updateCheckout
to replace line items, discounts, or trial terms on a Billing
Guide
Pass Billing-specific fields in paymentIntent for catalog products, subscriptions, and invoices.
checkout
intent. The steps below cover
update
. Billing checkout intents use Checkout update.
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
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
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)
importjava.nio.charset.StandardCharsets;importjava.security.SecureRandom;importjavax.crypto.Cipher;importjavax.crypto.Mac;importjavax.crypto.spec.IvParameterSpec;importjavax.crypto.spec.SecretKeySpec;importjava.util.Base64;publicclassFormUpdateGenerator{privatefinalStringpublicKey="api_pk_xxxxaxxxxbdf47a2aea17eb3xxxxxxxx";privatefinalStringsecretKey="api_sk_xxxxaxxxxbdf47a2aea17eb3xxxxxxxx";publicStringencryptPartialIntent(StringjsonString)throwsException{byte[]iv=newbyte[16];newSecureRandom().nextBytes(iv);SecretKeySpecaesKey=newSecretKeySpec(secretKey.substring(0,32).getBytes(StandardCharsets.UTF_8),"AES");Ciphercipher=Cipher.getInstance("AES/CBC/PKCS5Padding");cipher.init(Cipher.ENCRYPT_MODE,aesKey,newIvParameterSpec(iv));byte[]encrypted=cipher.doFinal(jsonString.getBytes(StandardCharsets.UTF_8));byte[]withIV=newbyte[iv.length+encrypted.length];System.arraycopy(iv,0,withIV,0,iv.length);System.arraycopy(encrypted,0,withIV,iv.length,encrypted.length);returnBase64.getEncoder().encodeToString(withIV).replace("+","-").replace("/","_");}publicStringgenerateSignature(StringjsonString)throwsException{Stringdata=publicKey+jsonString+publicKey;Macmac=Mac.getInstance("HmacSHA512");mac.init(newSecretKeySpec(secretKey.getBytes(StandardCharsets.UTF_8),"HmacSHA512"));byte[]hashBytes=mac.doFinal(data.getBytes(StandardCharsets.UTF_8));StringBuilderhexHash=newStringBuilder();for(byteb:hashBytes)hexHash.append(String.format("%02x",b&0xff));returnBase64.getEncoder().encodeToString(hexHash.toString().getBytes(StandardCharsets.UTF_8));}publicstaticvoidmain(String[]args)throwsException{FormUpdateGeneratorgen=newFormUpdateGenerator();StringpartialIntentJson="{\"amount\":1020,\"currency\":\"EUR\"}";// fill as described in documentation
StringpartialIntent=gen.encryptPartialIntent(partialIntentJson);Stringsignature=gen.generateSignature(partialIntentJson);// Pass partialIntent and signature to form.update() on the frontend
System.out.println("partialIntent: "+partialIntent);System.out.println("signature: "+signature);}}
require'openssl'require'base64'classFormUpdateGeneratorKEY_LENGTH=32IV_LENGTH=16definitialize@public_key='api_pk_xxxxaxxxxbdf47a2aea17eb3xxxxxxxx'@secret_key='api_sk_xxxxaxxxxbdf47a2aea17eb3xxxxxxxx'enddefencrypt_partial_intent(json_string)key=@secret_key[0,KEY_LENGTH]iv=OpenSSL::Random.random_bytes(IV_LENGTH)cipher=OpenSSL::Cipher.new('aes-256-cbc')cipher.encryptcipher.key=keycipher.iv=ivencrypted=cipher.update(json_string)+cipher.finalBase64.urlsafe_encode64(iv+encrypted).gsub('+','-').gsub('/','_')enddefgenerate_signature(json_string)data=@public_key+json_string+@public_keydigest=OpenSSL::Digest.new('sha512')hmac=OpenSSL::HMAC.hexdigest(digest,@secret_key,data)Base64.strict_encode64(hmac)endendgen=FormUpdateGenerator.newpartial_intent_json='{"amount":1020,"currency":"EUR"}'# fill as described in documentationpartial_intent=gen.encrypt_partial_intent(partial_intent_json)signature=gen.generate_signature(partial_intent_json)# Pass partial_intent and signature to form.update() on the frontendputs"partialIntent: #{partial_intent}"puts"signature: #{signature}"
usingSystem;usingSystem.Security.Cryptography;usingSystem.Text;classFormUpdateGenerator{privateconststringPublicKey="api_pk_xxxxaxxxxbdf47a2aea17eb3xxxxxxxx";privateconststringSecretKey="api_sk_xxxxaxxxxbdf47a2aea17eb3xxxxxxxx";publicstaticstringEncryptPartialIntent(stringjsonString){byte[]iv=newbyte[16];RandomNumberGenerator.Fill(iv);using(varaes=newRijndaelManaged()){aes.Key=Encoding.UTF8.GetBytes(SecretKey.Substring(0,32));aes.Mode=CipherMode.CBC;aes.Padding=PaddingMode.PKCS7;using(varencryptor=aes.CreateEncryptor(aes.Key,iv)){byte[]valueBytes=Encoding.UTF8.GetBytes(jsonString);byte[]encrypted=encryptor.TransformFinalBlock(valueBytes,0,valueBytes.Length);byte[]withIV=newbyte[iv.Length+encrypted.Length];Array.Copy(iv,0,withIV,0,iv.Length);Array.Copy(encrypted,0,withIV,iv.Length,encrypted.Length);returnConvert.ToBase64String(withIV).Replace("+","-").Replace("/","_");}}}publicstaticstringGenerateSignature(stringjsonString){stringdata=PublicKey+jsonString+PublicKey;using(varhmac=newHMACSHA512(Encoding.UTF8.GetBytes(SecretKey))){byte[]hashBytes=hmac.ComputeHash(Encoding.UTF8.GetBytes(data));stringhexHash=BitConverter.ToString(hashBytes).Replace("-","").ToLower();returnConvert.ToBase64String(Encoding.UTF8.GetBytes(hexHash));}}staticvoidMain(){stringpartialIntentJson="{\"amount\":1020,\"currency\":\"EUR\"}";// fill as described in documentationstringpartialIntent=EncryptPartialIntent(partialIntentJson);stringsignature=GenerateSignature(partialIntentJson);// Pass partialIntent and signature to form.update() on the frontendConsole.WriteLine("partialIntent: "+partialIntent);Console.WriteLine("signature: "+signature);}}
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.
A Billing checkout intent does not update plan, quantity, coupon, or trial through partialIntent and
update
. Those fields live on the checkout object at init, so the form exposes a separate
updateCheckout
method instead of the signed formUpdate flow above.
Checkout update
updateCheckout changes line items, discounts, or trial terms on a form initialized with a Billing checkout object. It applies to
Guide
Configure API access, create products and customers, set up recurring billing, handle webhook events, and manage cancellations with Solidgate.
Subscription 2.0
and
Guide
Configure API access, create products and customers, issue invoices, process payments, and handle webhook events to integrate Solidgate invoicing.
Invoice
intents that include checkout.mode as
subscription
or
invoice
.
The form instance uses
camelCase
field names. The encrypted
Guide
Pass Billing-specific fields in paymentIntent for catalog products, subscriptions, and invoices.
paymentIntent
uses
snake_case
for the same checkout data.
Prerequisites
updateCheckout works only on a payment intent created in checkout flow, with a checkout block and mode
invoice
or
subscription
.
A one-time payment intent, or an intent paid with product_price_id or invoice_id and no checkout block, fails with Not a checkout flow.
Method call
Call updateCheckout on the form instance returned from PaymentFormSdk.init. Do not send partialIntent or a backend formUpdate signature.
The method always settles the promise it returns. It resolves with the updated invoice preview on success, or rejects with an Error on failure. It does not throw synchronously. Wrap the await call in try/catch.
<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-->>'}asyncfunctiononReadyPaymentInstance(form:ClientSdkInstance):Promise<void>{try{constresult=awaitform.updateCheckout({lineItems:[{productPriceId:'b1e6c2b0-3a4d-4f2e-9b7a-1234567890ab',quantity:2}],discounts:[{couponCode:'SUMMER10'}],})// use result.invoicePreview
}catch(error){// handle UpdateCheckoutError
}}</script>
Per-line-item breakdown. Mirrors the request line items with computed amounts. Currency on each line matches the overall invoice currency.
Description
Line total.
Example
40.00
Description
Quantity.
Example
2
Description
ISO currency code for this line.
Example
USD
Description
Currency symbol for this line.
Example
$
Description
Price identifier echoing the request.
Example
b1e6c2b0-3a4d-4f2e-9b7a-1234567890ab
Description
Product identifier from the catalog.
Example
fa43b415-5522-4373-b026-a365562f9649
Description
Same shape as the top-level amounts, scoped to this line.
Example
1
2
3
4
{"subtotal":"50.00","discount":"10.00"}
Description
Tax classification and rate applied to this line. Includes categoryId, mode, and rate.
Error handling
When updateCheckout rejects, the caught value is an Error named UpdateCheckoutError. The Error message is a human-readable summary and includes the details payload.
details.message takes one of two shapes, depending on the kind of failure:
An array of strings for a request-level failure, for example ["Intent is not payable"] or ["Init payment not found"]. Render these as a general error banner.
An object mapping field to message for input that failed validation, for example { "lineItems[0].productPriceId": "must be a valid UUID" }. Render these as per-field hints.
Check which shape details.message is before using it.