You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using seller access tokens (manual integration, not OAuth)
Problem
When creating credit card payments using the Payments API with a
seller access token, we encounter different errors depending on
Authorization header handling:
With manual Authorization header in requestOptions:
PA_UNAUTHORIZED_RESULT_FROM_POLICIES (403)
Without Authorization header in requestOptions: internal_error
(500)
{
"blocked_by": "PolicyAgent",
"code": "PA_UNAUTHORIZED_RESULT_FROM_POLICIES",
"status": 403,
"message": "At least one policy returned UNAUTHORIZED."
}
SDK is initialized with MercadoPagoConfig({ accessToken:
sellerToken })
Payment body contains all required fields (token, installments,
payment_method_id, payer info)
SDK should automatically handle Authorization header
Additional Context
PIX payments work correctly with the same setup using Payments
API
OAuth flow works when using seller's OAuth access token
Card token is valid (generated via frontend MercadoPago SDK)
Test credentials being used (TEST- prefix tokens)
According to MercadoPago docs,
PA_UNAUTHORIZED_RESULT_FROM_POLICIES occurs when "Authorization
header is removed during request or Access Token not sent"
Questions
Should the Authorization header be manually set in requestOptions
when the SDK is already initialized with an access token via
MercadoPagoConfig?
Does the SDK properly handle Authorization for Payments API when
using seller tokens (non-OAuth)?
Are there additional requirements for credit card payments with
manual integration that aren't documented?
Is statement_descriptor allowed for non-certified accounts?
Workaround Attempted
✅ Using Payments API instead of Orders API (Orders API doesn't
support card tokens properly)
✅ Removing statement_descriptor for non-certified accounts
❌ Still getting errors regardless of Authorization header
handling
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
SDK Version:
"mercadopago": "^2.0.9"
Environment:
Problem
When creating credit card payments using the Payments API with a
seller access token, we encounter different errors depending on
Authorization header handling:
PA_UNAUTHORIZED_RESULT_FROM_POLICIES (403)
(500)
Code Sample
Response / Error
Attempt 1 (without Authorization header in requestOptions, letting
SDK handle it):
{ "blocked_by": "PolicyAgent", "code": "PA_UNAUTHORIZED_RESULT_FROM_POLICIES", "status": 403, "message": "At least one policy returned UNAUTHORIZED." }Attempt 2 (with manual Authorization header):
{ "message": "internal_error", "error": null, "status": 500, "cause": [] }Expected Behavior
The payment should be created successfully when:
sellerToken })
payment_method_id, payer info)
Additional Context
API
PA_UNAUTHORIZED_RESULT_FROM_POLICIES occurs when "Authorization
header is removed during request or Access Token not sent"
Questions
when the SDK is already initialized with an access token via
MercadoPagoConfig?
using seller tokens (non-OAuth)?
manual integration that aren't documented?
Workaround Attempted
support card tokens properly)
handling
Any guidance would be greatly appreciated!
Environment Details:
Beta Was this translation helpful? Give feedback.
All reactions