NoteTo protect user privacy, MiniApps must ask for user permission (consent) before using things like phone number, location, or camera.
1. Pre-Launch Consent (Handled by GoPay)
- A popup showing all available consents appears automatically before the MiniApp opens.
- This is shown every time the MiniApp opens if the user hasn’t granted all required permissions.
- This works only if permission is granted by GoPay to the MiniApp. (docs)
2. Post-Launch Consent (Handled by Merchant)
- A popup for specific consent appears only when the merchant calls the API or SDK listed below.
- This is shown only if the user didn’t grant the consent during pre-launch.
- You must call
getConsent('consentName')from our SDK before calling the actual API. - This works only if step 1 is done
If the user declines Mandatory consent then user cannot proceed
Use the getConsent SDK only for permissions marked as optional and during post-launch.
| API/SDK | Needs getConsent SDK |
|---|---|
| getProfile | ✅ Yes |
| getLocation | ✅ Yes |
| getDeviceInfo | ✅ Yes |
| getCamera | ✅ Yes |
| Integration Needed | Details |
|---|---|
| Mini App Frontend | Available since: GoPay 1.52.0 |
| Mini App npm SDK Version | Coming soon |
Sample Request:
miniAppSdk.getConsent(<consent_name>)
.then((result) => {
if(result.success) {
console.log('Consent provided');
}
else {
console.log('Error fetching code:', result.error, result.error?.message);
}
})Possible Consent Name:
| JSAPI | <consent_name> |
|---|---|
| getLocation(GoPay) | location |
| getCamera(Javascript) | camera |
| getProfile(GoPay) | You can get this from the error response from getProfile |
Sample Response:
Success Response:
type ConsentResponse = {
data: {
consent_name: string,
has_consent: boolean,
},
success: boolean,
error?: string
}- Data will be null in all cases of success.
- Error will be null in case of success = true, and vice versa.
Possible Error Codes:
| Error Code | Description |
|---|---|
| 100 | Method not supported error |
| 200 | Incomplete parameter error |
| 201 | Invalid type error |
| 202 | Parameter data error |
| 203 | Miniapp not registered |
| 300 | No permission error |
| 400 | Device not supported |
| 401 | Network error |
| 500 | Superapp error |