Compliance violation. flag based on the account origin ?

atum
Contributor
Contributor

Hi
I'm integrating online payment for some websites 
I have my personal PayPal since 2012 and new business account
Using rails 7
Started to integrate payment with paypal with paypal-sdk-rest gem.
The idea was to create order once payment success so I don't have redundant order records
When I used my api credintials which is an account with country flag EG.
I got this respond
Started POST /orders for 127.0.0.1 a[Removed. Phone #s not permitted]01:46 -0800 Processing by OrdersController#create as HTML Parameters: {authenticity_token=>[FILTERED] order=>{total_price=>23} commit=>Proceed to PayPal} Access Token Obtained: A21AALI8qTijd9SwEXIdJ3CdIZmTC_XGhJb39hDnMEsqRUkGQ-cFMGel142t1M42gdIshrCP_8WG29jh8s1dVrfJh0pzg_QMg TRANSACTION (0.1ms) begin transaction  app/controllers/orders_controller.rb:16:in create' Order Create (1.0ms) INSERT INTO orders (total_price status created_at updated_at paypal_order_id) VALUES (? ? ? ? ?) [[total_price 23.0] [status pending] [created_at[Removed. Phone #s not permitted]01:48.136023] [updated_at[Removed. Phone #s not permitted]01:48.136023] [paypal_order_id 4SD4973979955341H]]  app/controllers/orders_controller.rb:16:in create' TRANSACTION (24.1ms) commit transaction  app/controllers/orders_controller.rb:16:in create' Redirected to https://www.sandbox.paypal.com/checkoutnow?token=4SD4973979955341H Completed 302 Found in 1984ms (ActiveRecord: 25.2ms | Allocations: 5144)

Started GET /orders/execute?token=[FILTERED]&PayerID=9DGVZBWMXPJ5S for 127.0.0.1 a[Removed. Phone #s not permitted]02:38 -0800 Processing by OrdersController#execute as HTML Parameters: {token=>[FILTERED] PayerID=>9DGVZBWMXPJ5S} Order Load (0.1ms) SELECT orders.* FROM orders WHERE orders.paypal_order_id = ? LIMIT ? [[paypal_order_id 4SD4973979955341H] [LIMIT 1]]  app/controllers/orders_controller.rb:31:in execute' Access Token Obtained: A21AALI8qTijd9SwEXIdJ3CdIZmTC_XGhJb39hDnMEsqRUkGQ-cFMGel142t1M42gdIshrCP_8WG29jh8s1dVrfJh0pzg_QMg Capture Order Response: #<HTTParty::Response:0xfc80 parsed_response={name=>UNPROCESSABLE_ENTITY details=>[{issue=>COMPLIANCE_VIOLATION description=>Transaction cannot be processed due to a possible compliance violation. To get more information about the transaction call Customer Support.}] message=>The requested action could not be performed semantically incorrect or failed business validation. debug_id=>f81412875eeb5 links=>[{href=>https://developer.paypal.com/api/rest/reference/orders/v2/errors/#COMPLIANCE_VIOLATION rel=>information_link method=>GET}]} @response=#<Net::HTTPUnprocessableEntity 422 Unknown Error readbody=true> @headers={connection=>[close] content-length=>[521] http_x_pp_az_locator=>[ccg18.slc] cache-control=>[max-age=0 no-cache no-store must-revalidate] server=>[nginx] content-type=>[application/json] server-timing=>[traceparent;desc=\00-0000000000000000000f81412875eeb5-ba7265c4bd6357cf-01\] traceparent=[Removed. Phone #s not permitted]91fbc4a56-01] access-control-expose-headers=>[Server-Timing] paypal-debug-id=>[f81412875eeb5] strict-transport-security=>[max-age=31536000; includeSubDomains] x-backend-info=>[v=1;name=2k1u3gOGb2cebCyZJujTUN--F_ccg18_wju_origin_api_m_2_sandbox_paypal_com;ip=34.106.111.220;port=443;ssl=1;max=200;ka_ns=0;tka_s=300;tki_s=10;tkp=3;host=api-m.sandbox.paypal.com;min_tls=;max_tls=;sni=edge.sandbox.paypal.com;cert_host=edge.sandbox.paypal.com;ciphers=;check_cert=1;no_reneg=1;to_ns=1000000000;fbto_ns=59000000000;bbto_ns=10000000000] accept-ranges=>[bytes] via=>[1.1 varnish 1.1 varnish] edge-control=>[max-age=0] date=>[Tue 05 No[Removed. Phone #s not permitted]GMT] x-served-by=>[cache-lhr-egll1980023-LHR cache-lhr-egll1980051-LHR cache-lcy-eglc8600090-LCY] x-cache=>[MISS MISS MISS] x-cache-hits=>[0 0 0] x-timer=>[S1730768559.368541VS0VE1027] vary=>[Accept-Encoding]}> PayPal API Error: 422 - Unknown Error - {name=>UNPROCESSABLE_ENTITY details=>[{issue=>COMPLIANCE_VIOLATION description=>Transaction cannot be processed due to a possible compliance violation. To get more information about the transaction call Customer Support.}] message=>The requested action could not be performed semantically incorrect or failed business validation. debug_id=>f81412875eeb5 links=>[{href=>https://developer.paypal.com/api/rest/reference/orders/v2/errors/#COMPLIANCE_VIOLATION rel=>information_link method=>GET}]} Redirected to http://localhost:3000/orders/new Completed 302 Found in 2256ms (ActiveRecord: 0.1ms | Allocations: 4223)
 
When I use a foreign account the order created 
 
Started GET /orders/execute?token=[FILTERED]&PayerID=9DGVZBWMXPJ5S for 127.0.0.1 a[Removed. Phone #s not permitted]14:07 -0800 Processing by OrdersController#execute as HTML Parameters: {token=>[FILTERED] PayerID=>9DGVZBWMXPJ5S} Order Load (0.2ms) SELECT orders.* FROM orders WHERE orders.paypal_order_id = ? LIMIT ? [[paypal_order_id 4AW46830FN997525X] [LIMIT 1]]  app/controllers/orders_controller.rb:31:in execute' Access Token Obtained: A21AALnBj92qvpsFlY90C-i-jxX5-uTv4iT2LjSbPzXG-aLA3wNtE_GpqVhyXFxqgXwMlby-bgGneN6XQRrVH7UFKEJkxjnEA Capture Order Response: #<HTTParty::Response:0xfcf8 parsed_response={id=>4AW46830FN997525X status=>COMPLETED payment_source=>{paypal=>{email_address=>sb-FLAG account_id=>9DGVZBWMXPJ5S account_status=>VERIFIED name=>{given_name=>John surname=>Doe} address=>{country_code=>US}}} purchase_units=>[{reference_id=>default shipping=>{name=>{full_name=>John Doe} address=>{address_line_1=>1 Main St admin_area_2=>San Jose admin_area_1=>CA postal_code=>95131 country_code=>US}} payments=>{captures=>[{id=>5HB625582A864753N status=>COMPLETED amount=>{currency_code=>USD value=>55.00} final_capture=>true seller_protection=>{status=>ELIGIBLE dispute_categories=>[ITEM_NOT_RECEIVED UNAUTHORIZED_TRANSACTION]} seller_receivable_breakdown=>{gross_amount=>{currency_code=>USD value=>55.00} paypal_fee=>{currency_code=>USD value=>2.45} net_amount=>{currency_code=>USD value=>52.55} receivable_amount=>{currency_code=>CHF value=>44.28} exchange_rate=>{source_currency=>USD target_currency=>CHF value=>0.8426925}} links=>[{href=>https://api.sandbox.paypal.com/v2/payments/captures/5HB625582A864753N rel=>self method=>GET} {href=>https://api.sandbox.paypal.com/v2/payments/captures/5HB625582A864753N/refund rel=>refund method=>POST} {href=>https://api.sandbox.paypal.com/v2/checkout/orders/4AW46830FN997525X rel=>up method=>GET}] create_time=>2024-11-05T01:14:08Z update_time=>2024-11-05T01:14:08Z}]}}] payer=>{name=>{given_name=>John surname=>Doe} email_address=>sb-FLAG payer_id=>9DGVZBWMXPJ5S address=>{country_code=>US}} links=>[{href=>https://api.sandbox.paypal.com/v2/checkout/orders/4AW46830FN997525X rel=>self method=>GET}]} @response=#<Net::HTTPCreated 201 Created readbody=true> @headers={connection=>[close] content-length=>[1785] http_x_pp_az_locator=>[ccg18.slc] cache-control=>[max-age=0 no-cache no-store must-revalidate] server=>[nginx] content-type=>[application/json] server-timing=>[traceparent;desc=\00-0000000000000000000f931377148d36-26548baf212053c8-01\] traceparent=>[00-0000000000000000000f931377148d36-e2c2c4b699b3a667-01] access-control-expose-headers=>[Server-Timing] paypal-debug-id=>[f931377148d36] strict-transport-security=>[max-age=31536000; includeSubDomains] x-backend-info=>[v=1;name=2k1u3gOGb2cebCyZJujTUN--F_ccg18_wju_origin_api_m_2_sandbox_paypal_com;ip=34.106.111.220;port=443;ssl=1;max=200;ka_ns=0;tka_s=300;tki_s=10;tkp=3;host=api-m.sandbox.paypal.com;min_tls=;max_tls=;sni=edge.sandbox.paypal.com;cert_host=edge.sandbox.paypal.com;ciphers=;check_cert=1;no_reneg=1;to_ns=1000000000;fbto_ns=59000000000;bbto_ns=10000000000] accept-ranges=>[bytes] via=>[1.1 varnish 1.1 varnish] edge-control=>[max-age=0] date=>[Tue 05 No[Removed. Phone #s not permitted]GMT] x-served-by=>[cache-lhr-egll1980031-LHR cache-lhr-egll1980058-LHR cache-mrs10554-MRS] x-cache=>[MISS MISS MISS] x-cache-hits=>[0 0 0] x-timer=>[S1730769248.674758VS0VE1110] vary=>[Accept-Encoding]}> TRANSACTION (2.6ms) begin transaction  app/controllers/orders_controller.rb:55:in execute' Order Update (0.7ms) UPDATE orders SET status = ? updated_at = ? WHERE orders.id = ? [[status completed] [updated_at[Removed. Phone #s not permitted]14:08.816638] [id 8]]  app/controllers/orders_controller.rb:55:in execute' TRANSACTION (11.4ms) commit transaction  app/controllers/orders_controller.rb:55:in execute' Redirected to http://localhost:3000/orders/8 Completed 302 Found in 1832ms (ActiveRecord: 14.9ms | Allocations: 6475)
So both my accounts are not working 12 years personal and new business account
So my question is this only for sandbox if it's live things would be different and my EG account would be allow to receive payments?
If they are connected to US bank?
I'm also receiving money so I think it's not a bank issue
If I push it to production would it be different?
Is there is any solution for this?
Thank you
Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.