INVALID_COMPLETE_PAYMENT_URL when creating customer with payment method

When posting to “/v1/customers” to create customer with (fake) payment method, I get the error:

{
“status”: {
“error_code”: “INVALID_COMPLETE_PAYMENT_URL”,
“status”: “ERROR”,
“message”: “The request tried to create a payment, but the \u0027complete_payment_url\u0027 parameter was not valid. The request was rejected. Corrective action: Use the correct URL.”,
“response_code”: “INVALID_COMPLETE_PAYMENT_URL”,
“operation_id”: “46aba627-2cf5-4ae8-9fe8-55db82b08789”
}
}

The body of the POST looks like this:

{“name”:“Customer name",“email”:"someemail@gmail.com”,“payment_method”:{“type”:“is_visa_card”,“fields”:{“number”:“4111111111111111”,“expiration_month”:“10”,“expiration_year”:“23”,“cvv”:“123”,“name”:“Customer name”}}

I’ve tried placing “payment_options” (and “payment_method_options”) in the body as well, in various places:

“payment_method_options”: {“complete_payment_url”:“http://1.2.3.4:3000/rapyd",“error_payment_url”:"http://1.2.3.4:3000/rapyd”}

So I’m a bit lost where it should actually be specified and couldn’t find out based on the documentation.

Thanks!

Thanks @abo. I’ve posted a request and response below that works for me. Let me know if you have any questions.

Create Customer with Payment Method Request

{
    "name": "Test User",
    "business_vat_id": "123456666",
    "email": "testuser@rapyd.net",
    "ewallet": "ewallet_622b1deb47c3391d9075fd1f5c09a3e5",
    "invoice_prefix": "TU-",
    "metadata": {
        "merchant_defined": true
    },
    "payment_method": {
    "type": "is_visa_card",
    "fields": {
        "name": "Test User",
        "number": "4111111111111111",
        "expiration_month": "08",
        "expiration_year": "24",
        "cvv": "789"
    },
    "complete_payment_url": "https://samsung.com",
    "error_payment_url": "https://apple.com"
    },
    "phone_number": "+14155556666"
}

Create Customer with Payment Method Response

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "4e9ccd88-e628-40f6-b347-1f843dda16e1"
    },
    "data": {
        "id": "cus_438a1c1c7dc37f0a92cea6bfdf473996",
        "delinquent": false,
        "discount": null,
        "name": "Test User",
        "default_payment_method": "card_808d76b2d27617f0c5b49895606d9f45",
        "description": "",
        "email": "testuser@rapyd.net",
        "phone_number": "+14155556666",
        "invoice_prefix": "TU-",
        "addresses": [],
        "payment_methods": {
            "data": [
                {
                    "id": "card_808d76b2d27617f0c5b49895606d9f45",
                    "type": "is_visa_card",
                    "category": "card",
                    "metadata": null,
                    "image": "https://iconslib.rapyd.net/checkout/is_visa_card.png",
                    "authentication_url": "",
                    "webhook_url": "",
                    "supporting_documentation": "",
                    "name": "Test User",
                    "last4": "1111",
                    "acs_check": "unchecked",
                    "cvv_check": "unchecked",
                    "bin_details": {
                        "brand": null,
                        "bin_number": "411111"
                    },
                    "expiration_year": "24",
                    "expiration_month": "08",
                    "fingerprint_token": "ocfp_2a694038316f52122bbbb3ae926cfda9",
                    "redirect_url": "https://sandboxdashboard.rapyd.net/3ds-payment?token=payment_fa1cf4249fdf098356b42f6cda09d9c2"
                }
            ],
            "has_more": false,
            "total_count": 1,
            "url": "/v1/customers/cus_438a1c1c7dc37f0a92cea6bfdf473996/payment_methods"
        },
        "subscriptions": null,
        "created_at": 1623092363,
        "metadata": {
            "merchant_defined": true
        },
        "business_vat_id": "123456666",
        "ewallet": "ewallet_622b1deb47c3391d9075fd1f5c09a3e5",
        "complete_payment_url": "https://samsung.com",
        "error_payment_url": "https://apple.com"
    }
}```
4 Likes

That did the trick! Thank you for the speedy response, awesome!

1 Like

This error is coming for “sg_debit_visa_card” but not for “us_visa_card”. Why is that?
Even in the card requirement fields, there’s no mention of this “complete_url” field.

Thanks @GermaVinsmoke, is this in Sandbox?

What error are you getting? I was able to create with the following.

Create Customer Payment Method

Request

{
    "name": "Test User",
    "business_vat_id": "1234566667",
    "email": "testuser@rapyd.net",
    "ewallet": "ewallet_6e50c83cedb7e380fad467ee63c13ce6",
    "invoice_prefix": "TU-",
    "metadata": {
        "merchant_defined": true
    },
    "payment_method": {
    "type": "sg_debit_visa_card",
    "fields": {
        "name": "Test User",
        "number": "4111111111111111",
        "expiration_month": "08",
        "expiration_year": "24",
        "cvv": "789"
    },
    "complete_payment_url": "https://samsung.com",
    "error_payment_url": "https://apple.com"
    },
    "phone_number": "+14155556666"
}

Response

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "b10c945e-2d84-4913-bb0d-a4ec7f8e649e"
    },
    "data": {
        "id": "cus_e595778cd4df684b9790c398e30a8f5a",
        "delinquent": false,
        "discount": null,
        "name": "Test User",
        "default_payment_method": "card_03ee569153845498755b035f9d0096e2",
        "description": "",
        "email": "testuser@rapyd.net",
        "phone_number": "+14155556666",
        "invoice_prefix": "TU-",
        "addresses": [],
        "payment_methods": {
            "data": [
                {
                    "id": "card_03ee569153845498755b035f9d0096e2",
                    "type": "sg_debit_visa_card",
                    "category": "card",
                    "metadata": null,
                    "image": "https://iconslib.rapyd.net/checkout/sg_debit_visa_card.png",
                    "webhook_url": "",
                    "supporting_documentation": "",
                    "next_action": "3d_verification",
                    "name": "Test User",
                    "last4": "1111",
                    "acs_check": "unchecked",
                    "cvv_check": "unchecked",
                    "bin_details": {
                        "type": null,
                        "brand": null,
                        "country": null,
                        "bin_number": "411111"
                    },
                    "expiration_year": "24",
                    "expiration_month": "08",
                    "fingerprint_token": "ocfp_2a694038316f52122bbbb3ae926cfda9",
                    "redirect_url": "https://sandboxcheckout.rapyd.net/3ds-payment?token=payment_b544a98f05d76c72469d5c7c00582769"
                }
            ],
            "has_more": false,
            "total_count": 1,
            "url": "/v1/customers/cus_e595778cd4df684b9790c398e30a8f5a/payment_methods"
        },
        "subscriptions": null,
        "created_at": 1648247548,
        "metadata": {
            "merchant_defined": true
        },
        "business_vat_id": "1234566667",
        "ewallet": "ewallet_6e50c83cedb7e380fad467ee63c13ce6",
        "complete_payment_url": "https://samsung.com",
        "error_payment_url": "https://apple.com"
    }
} 

The complete_payment_url field is in the Payment Object and can be listed in the Payment Method Type Object using List Payment Methods by Country.

For example

     {
            "type": "sg_debit_visa_card",
            "name": "Visa Debit",
            "category": "card",
            "image": "https://iconslib.rapyd.net/checkout/sg_debit_visa_card.png",
            "country": "sg",
            "payment_flow_type": "",
            "currencies": [
                "AED",
                "AUD",
                "BDT",
                "BND",
                "BRL",
                "CAD",
                "CHF",
                "CNY",
                "COP",
                "CZK",
                "DKK",
                "EGP",
                "EUR",
                "FJD",
                "GBP",
                "HKD",
                "HUF",
                "IDR",
                "ILS",
                "INR",
                "IQD",
                "IRR",
                "ISK",
                "JPY",
                "KRW",
                "KWD",
                "LAK",
                "LKR",
                "MMK",
                "MOP",
                "MXN",
                "MYR",
                "NGN",
                "NOK",
                "NPR",
                "NZD",
                "PHP",
                "PKR",
                "PLN",
                "QAR",
                "RUB",
                "SAR",
                "SCR",
                "SEK",
                "SGD",
                "THB",
                "TRY",
                "TWD",
                "USD",
                "VND",
                "ZAR"
            ],
            "status": 1,
            "is_cancelable": true,
            "payment_options": [
                {
                    "name": "capture",
                    "type": "boolean",
                    "regex": "",
                    "description": "Determines when the payment is processed for capture.",
                    "is_required": false,
                    "is_updatable": false
                },
                {
                    "name": "complete_payment_url",
                    "type": "string",
                    "regex": "",
                    "description": "the complete_payment_url field must be filled in.",
                    "is_required": true,
                    "is_updatable": false
                },
                {
                    "name": "error_payment_url",
                    "type": "string",
                    "regex": "",
                    "description": "the error_payment_url field must be filled in.",
                    "is_required": true,
                    "is_updatable": false
                }

Hi @Community_Team ,
Thanks for your reply.

I am trying to create a customer with a payment method for “ro_visa_card”;
This is my body for the request.
{
“name”: “Jane Doe”,
“email”: “janedoe6666@rapyd.net”,
“payment_method”: {
“type”: “ro_visa_card”,
“fields”: {
“number”: “4111111111111111”,
“expiration_month”: “10”,
“expiration_year”: “23”,
“cvv”: “123”,
“name”: “Test User”
},
“complete_payment_url”: “xx”
“error_payment_url”: “xx”
}
}
I got this response
{
“status”: {
“error_code”: “ERROR_CREATE_PAYMENT_METHOD”,
“status”: “ERROR”,
“message”: “The request attempted an operation that requires specific fields for payment method, but a required field was missing, or an extra, unallowed field was included. Corrective action: Run ‘Get Payment Method Required Fields’ and check all input fields.”,
“response_code”: “ERROR_CREATE_PAYMENT_METHOD”,
“operation_id”: “ba27ea04-b734-4d25-a120-1cc2df51da0a”
}
}

I also tried this
{
“name”: “Jane Doe”,
“email”: “janedoe6666@rapyd.net”,
“payment_method”: {
“type”: “ro_visa_card”,
“fields”: {
“number”: “4111111111111111”,
“expiration_month”: “10”,
“expiration_year”: “23”,
“cvv”: “123”,
“name”: “Test User”
},
“payment_options”: {
“complete_payment_url”: “xx”,
“error_payment_url”: “xx”
}
}
}
but I got this response
{
“status”: {
“error_code”: “INVALID_COMPLETE_PAYMENT_URL”,
“status”: “ERROR”,
“message”: “The request tried to create a payment, but the ‘complete_payment_url’ parameter was not valid. The request was rejected. Corrective action: Use the correct URL.”,
“response_code”: “INVALID_COMPLETE_PAYMENT_URL”,
“operation_id”: “5214c28e-a7c7-4bf7-b8fd-5adefe100914”
}
}

Do you have any idea about that?

FYI, I put xx instead of the link because I am a new user here.

Thanks @Ahmad_Aldali. For the second request with INVALID_COMPLETE_PAYMENT_URL, the payment method would require a complete URL and error URL field. This is due to having any 3DS or 3rd party authentication for the card payment.

You can find this information in the Payment Method Type Object using List Payment Methods by Country or Get Required Payment Method Fields.

Here’s the required fields which include error payment and complete payment url below. ro_visa_card

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "29269039-bd4f-4636-ac25-d21cb3b10928"
    },
    "data": {
        "type": "ro_visa_card",
        "fields": [
            {
                "name": "name",
                "type": "string",
                "regex": "",
                "is_required": true,
                "instructions": "card holder name"
            },
            {
                "name": "number",
                "type": "string",
                "regex": "",
                "is_required": true,
                "instructions": "card number"
            },
            {
                "name": "expiration_month",
                "type": "string",
                "regex": "",
                "is_required": true,
                "instructions": "expiration month as string, 01-12"
            },
            {
                "name": "expiration_year",
                "type": "string",
                "regex": "",
                "is_required": true,
                "instructions": "expiration year in to digits as string, 18-99"
            },
            {
                "name": "cvv",
                "type": "string",
                "regex": "",
                "is_required": true,
                "instructions": "card cvv"
            }
        ],
        "payment_method_options": [
            {
                "name": "3d_required",
                "type": "boolean",
                "regex": "",
                "description": "Allows the client to determine whether the customer is required to complete 3DS authentication for the transaction",
                "is_required": false,
                "is_updatable": false
            },
            {
                "name": "3d_version",
                "type": "String",
                "regex": "(1.0.2|2.1.0|2.2.0)",
                "description": "3D Secure version of the transaction.",
                "is_required": false,
                "is_updatable": false
            },
            {
                "name": "cavv",
                "type": "String",
                "regex": "",
                "description": "Cardholder Authentication Verification Value represented as a 20-byte value that is base64 encoded.",
                "is_required": false,
                "is_updatable": false
            },
            {
                "name": "eci",
                "type": "String",
                "regex": "(01|02|05|06|07|08)",
                "description": "Electronic Commerce Indicator (ECI) from MPI Plugin(3-D Secure 1.0) or 3DS Server(3-D Secure 2.0).",
                "is_required": false,
                "is_updatable": false
            },
            {
                "name": "xid",
                "type": "String",
                "regex": "",
                "description": "3D Secure XID, Base64 encoded.Required for VISA 1.0",
                "is_required": false,
                "is_updatable": false
            },
            {
                "name": "ds_trans_id",
                "type": "String",
                "regex": "",
                "description": "The Directory Server (DS) Transaction ID. Required Mastercard 2.0.",
                "is_required": false,
                "is_updatable": false
            },
            {
                "name": "recurrence_type",
                "type": "string",
                "regex": "(recurring|installment|unscheduled)",
                "description": "This indicates the purpose of the token. should be aligned with the subsequent payments using the token.",
                "is_required": false,
                "is_updatable": false
            }
        ],
        "payment_options": [
            {
                "name": "description",
                "type": "string",
                "regex": "",
                "description": "the description field must be filled in.",
                "is_required": false,
                "is_updatable": false
            },
            {
                "name": "capture",
                "type": "boolean",
                "regex": "",
                "description": "Determines when the payment is processed for capture.",
                "is_required": false,
                "is_updatable": false
            },
            {
                "name": "complete_payment_url",
                "type": "string",
                "regex": "",
                "description": "the complete_payment_url field must be filled in.",
                "is_required": true,
                "is_updatable": false
            },
            {
                "name": "error_payment_url",
                "type": "string",
                "regex": "",
                "description": "the error_payment_url field must be filled in.",
                "is_required": true,
                "is_updatable": false
            }
        ],
        "minimum_expiration_seconds": 600,
        "maximum_expiration_seconds": 604800
    }
}

For the first request error, ERROR_CREATE_PAYMENT_METHOD I’ve put in a ticket and waiting to hear back.

Thanks @Community_Team
Looking forward to hearing from you soon.

1 Like

For completing and testing things quickly, you can create 2 simple HTML pages and deploy it on vercel. I also did the same :ok_hand:t2:

1 Like

Hi @GermaVinsmoke
I don’t think that will solve the problem. but I am going to try.

It’ll solve the problem of “INVALID_COMPLETE_PAYMENT_URL”
We need to provide 2 URLs for 3DS verification of the cards.
complete_payment_url and error_payment_url

Yes, when I provided them as static values as is shown in Kyle’s replay, that error disappeared. But I got another error “ERROR_CREATE_PAYMENT_METHOD” with this message
“The request attempted an operation that requires specific fields for payment method, but a required field was missing, or an extra, unallowed field was included."

Could you send me a screenshot of your code example for that request?
Regards.

I tried to create the customer with this “ro_visa_card” payment method.
I’m also getting the same error. I’m not sure why it isn’t working even after providing the all the fields.

Thanks for letting me know.
Regards.

Btw, is ro → Romania?

Should be that.

Edit: Updated the second method listed below using API only

Thanks @Ahmad_Aldali. Also thanks @GermaVinsmoke for chiming in.

I reported this as this is not the intended behavior for Sandbox.

I also found a couple work arounds with the following:

  1. Create a Customer without a Payment Method
  2. Save Card Details Hosted Page

or

API Only

  1. Create a Customer without a Payment Method
    Create an address ID
    Use ro_visa_card to tokenize a card with address ID
  2. Use Card info to add payment method to the customer | See below

Add Payment Method to Customer API

Request

{
    "type": "us_debit_mastercard_card",
    "fields": {
        "number": "4111111111111111",
        "expiration_month": "12",
        "expiration_year": "25",
        "cvv": "555",
        "name": "John Doe"
    },
    "metadata": {
        "merchant_defined": true
    }
}

Response

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "5181e259-69ea-4abd-94c4-020c8f72d00a"
    },
    "data": {
        "id": "card_c0a7dafb6840de42b9b9e28015136abd",
        "type": "us_debit_mastercard_card",
        "category": "card",
        "metadata": {
            "merchant_defined": true
        },
        "image": "",
        "webhook_url": "",
        "supporting_documentation": "",
        "next_action": "3d_verification",
        "name": "John Doe",
        "last4": "1111",
        "acs_check": "unchecked",
        "cvv_check": "unchecked",
        "bin_details": {
            "type": null,
            "brand": null,
            "level": null,
            "country": null,
            "bin_number": "411111"
        },
        "expiration_year": "25",
        "expiration_month": "12",
        "fingerprint_token": "ocfp_2a694038316f52122bbbb3ae926cfda9",
        "redirect_url": "https://sandboxcheckout.rapyd.net/3ds-payment?token=payment_2d60b0b719ed4479a66a81218d54e863"
    }
}
2 Likes

Thanks @Community_Team
I will try that.

I appreciate your help.
Regards.

1 Like

Hi @Community_Team
Now, when I am trying to tokenize the token, i get the following response:
{
‘error_code’ => ‘ERROR_GET_PAYMENT_METHOD_TYPE’,
‘status’ => ‘ERROR’,
‘message’ => ‘The request attempted an operation that requires a payment method, but the payment method type specified is not available for this merchant or does not exist at all. Corrective action: Use a payment method type that this merchant is authorized to use.’,
}
url: “https://sandboxapi.rapyd.net/v1/tokens”;
It was working fine a month ago.

Regards.

Thanks @Ahmad_Aldali, I updated the flow. You can create a customer and then add the card details in the second step.

Also check the payment method type if it is listed in Rapyd Docs | Error for your country.