Frontend APIs (GoPay Container V4)

This guide explains the technical specifications of JSAPIs that is available to be called from your application's frontend.

Integrate SDK

  1. Include the gpContainer SDK in Your Codebase
    To use the SDK, add the following

    <script src="https://gwk.gopayapi.com/sdk/stable/gp-container.min.js"></script>
    
  2. Invoking SDK Methods
    To call any JSAPI from the SDK, use the following format:

    window.gpContainer.call(className, methodName, params, successCallback, failureCallback, timeout);
    


Supported JSAPIs

GPLocation (need to change all openlinks)

APIFunctionRequires Consent
GPLocation.getLocationObtain user's device locationyes

GPMiniAppAuth

APIFunctionRequires Consent
GPMiniAppAuth.getAuthCodeGet an auth code used to identify the current user sessionNo

GPNavigator

APIFunctionRequires Consent
GPNavigator.launchDeeplinkOpen a third-party app or page using a custom deeplinkNo
GPNavigator.launchUriOpen a browser or in-app page using a universal or web URINo

GP

APIFunctionRequires Consent
GP.launchPaymentAutomatically redirect users to the GoPay app to complete the payment, then return them to your Mini App.No


Version History

VersionDescriptionDate
0.4.0Initial Release for V1 (Deprecated)10/07/25
1.0.0Initial Release for V418/07/25

JSAPIs Specification (v1.0.0)

📝

Note

  • Data will be null in case of success = false, and vice versa.
  • Error will be null in case of success = true, and vice versa.

Get Location

Sample Request:

var params = {
	// Specify whether to obtain a high-precision location.
	enable_high_accuracy: true
};

window.gpContainer.call(  
  "GPLocation",  
  "getLocation",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
    "data": {
      "coords": {
        "longitude": 77.5946,
        "latitude": 12.9716,
        "time": 12
      }
    },
    "ret": "GP_SUCCESS" 
}
{
    "success": false,
    "error_code": "",
    "error_type": "JS_BRIDGE_ERROR",
    "error_message": "",
    "ret": "GP_EXCEPTION"   
}

Get Auth Code

Sample Request:

window.gpContainer.call(  
  "GPMiniAppAuth",  
  "getAuthCode",  
  {},  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
    "data": {
        authCode: "GBNURP5WyBIqXiGxKv2cO8Qj4CyS0qZrRK5O4e8ehdnHpowG6k5pkj2SsF7BqGIF"
    },
		"ret": "GP_SUCCESS" 
}
{
    "success": false,
    "error_code": "",
    "error_type": "JS_BRIDGE_ERROR",
    "error_message": "",
    "ret": "GP_EXCEPTION"   
}

Launch Deeplink

Sample Request:

var params = {
  deeplink: "gopay://..."
};

window.gpContainer.call(  
  "GPNavigator",  
  "launchDeeplink",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
		success: true,
		"ret": "GP_SUCCESS" 
}
{
    "success": false,
    "error_code": "300",
    "error_type": "JS_BRIDGE_ERROR",
    "error_message": "Permission denied",
    "ret": "GP_EXCEPTION"   
}

Launch Payment

Sample Request:

var params = {
  deeplink: "gopay://..."
};

window.gpContainer.call(  
  "GP",  
  "launchPayment",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    success: true,
    data: {
        status: "success"
    },
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "error_code": "300",
    "error_type": "JS_BRIDGE_ERROR",
    "error_message": "Permission denied",
    "ret": "GP_EXCEPTION"   
}
StatusDescription
successUser have successfully paid the transaction
failedUser cancelled the transaction
pendingThere's an error processing the transaction
cancelledUser goes back to the miniapp without completing or cancelling the payment

Launch Uri

Sample Request:

var params = {
  uri: "string"
};

window.gpContainer.call(  
  "GPNavigator",  
  "launchUri",  
  params,  
  function(response) {  
    console.log('success:', response);  
  },  
  function(error) {  
    console.log('error:', error);  
  }  
);

Sample Response: (error codes)

{
    "success": true,
		"ret": "GP_SUCCESS"
}
{
    "success": false,
    "error_code": "",
    "error_type": "JS_BRIDGE_ERROR",
    "error_message": "",
    "ret": "GP_EXCEPTION"   
}

Error Codes

Category:

CategoryCodeDescription
Platform Error1xxPlatform-related errors, such as opening gopay deeplink while you're testing on the web
Miniapp Error2xxSuch as method invocation error calling openDeeplink with a wrong deeplink format
Permission Error3xxPermission-related error, such as getting user location but the user does not give the permission
Device related Error4xxReturned on device-related error such as network error
Superapp Error5xxError from the superapp side (imagine this as server error)

Error Code List:

CodesDescriptionHappens When
100Method not supported errorThe miniapp is calling a method that's not supported on the platform.
200Incomplete parameter errorThe method call have incomplete parameters
201Invalid type errorThe method call have invalid parameters. E.g. providing int while the required type is string
202Parameter data errorThe parameters being called is not supported by gopay. E.g. calling open deeplink with non-gopay deeplink
203Miniapp not registeredThe miniapp you're developing is not registered inside gopay system
300No permission errorMiniapp does not have access to the method being called
400Device not supportedThe resource being requested is not supported by the device
401Network ErrorInternet related problem such as slow or disconnected internet
500Superapp errorSuperapp related error. Happens if there's an internal error in gopay while a resource is requested