# Make declined Payment using CreatePayment method

**URL:** <https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [October 20, 2020, 6:36pm UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095 "2020-10-20T18:36:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarv](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@amarv](https://developer.squareup.com/forums/u/amarv)\
**Post date:** [October 20, 2020, 6:36pm UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095/1 "2020-10-20T18:36:14Z")

</div>

How to make a failed payments with the CreatePayment function?. I am passing the CustomerId and Source Id as Customer Card Id, and not the cnon:card-nonce-ok and ccof:customer-card-id-ok. Please guide me, I am using C# SDK

---

<div class="post-metadata">

**Author:** ![sjosey](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/sjosey/32/40_2.png) [@sjosey](https://developer.squareup.com/forums/u/sjosey)\
**Post date:** [October 20, 2020, 8:00pm UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095/2 "2020-10-20T20:00:44Z")

</div>

Hi @amarv welcome to the forums!

In sandbox, you can pass specific values to test different scenarios, including failures. Take a look here: [https://developer.squareup.com/docs/testing/test-values#error-state-values](https://developer.squareup.com/docs/testing/test-values#error-state-values). Please let me know if you have any additional questions or concerns, I’m happy to help!

---

<div class="post-metadata">

**Author:** ![amarv](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@amarv](https://developer.squareup.com/forums/u/amarv)\
**Post date:** [October 20, 2020, 9:03pm UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095/3 "2020-10-20T21:03:25Z")

</div>

Yes, Initially I have looked at the page which is mentioned above. But I am trying to process the payment from the saved card details as like below.

‘{  
“amount\_money”: {  
“amount”: 300,  
“currency”: “USD”  
},  
“customer\_id”: “YYFKNXCDV0SSNFCXC27J3XFXDW”,  
“source\_id”: “ccof:eDmUskYKwjmTEXf43GB”,  
“autocomplete”: true,  
“idempotency\_key”: “e89307e8-650e-423b-8ddf-7c6ed23a5286”,  
“reference\_id”: “63e82ffd-6c32-4f1a-9f36-1d49edb9fc84”  
}’

---

<div class="post-metadata">

**Author:** ![sjosey](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/sjosey/32/40_2.png) [@sjosey](https://developer.squareup.com/forums/u/sjosey)\
**Post date:** [October 20, 2020, 9:12pm UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095/4 "2020-10-20T21:12:10Z")

</div>

I’m not sure I’m following. Did you use one of the error values to save the card on file?

---

<div class="post-metadata">

**Author:** ![amarv](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@amarv](https://developer.squareup.com/forums/u/amarv)\
**Post date:** [October 20, 2020, 10:36pm UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095/5 "2020-10-20T22:36:51Z")

</div>

Our process is, capturing the customer card information from the SQPaymentForm, and used the Customers.CreateCustomerCard method to Create a CardId for future payments. If we provide the values mentioned in the [https://developer.squareup.com/docs/testing/test-values#error-state-values](https://developer.squareup.com/docs/testing/test-values#error-state-values) during CreateCustomerCard it’s throwing an exception. But when Pass card id via Payment.CreatePayment method it’s not throwing any error. Since the CardId is valid and it’s not fall on any criteria mentioned in the above URL.

---

<div class="post-metadata">

**Author:** ![sjosey](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/sjosey/32/40_2.png) [@sjosey](https://developer.squareup.com/forums/u/sjosey)\
**Post date:** [October 20, 2020, 10:46pm UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095/6 "2020-10-20T22:46:17Z")

</div>

I just tested the “911” CVV error one, created a nonce, and passed it to `CreatePayment`, and it fails with `CVV_FAILURE`. I created another nonce with “911” CVV, and passed it to `CreateCustomerCard` and got `VERIFY_CVV_FAILURE`.

How are you getting a card id, if the `CreateCustomerCard` is failing?

---

<div class="post-metadata">

**Author:** ![amarv](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@amarv](https://developer.squareup.com/forums/u/amarv)\
**Post date:** [October 21, 2020, 4:06am UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095/7 "2020-10-21T04:06:40Z")

</div>

I would restructure my Question, We are having two screens on the first screen we will capture the Customer Card information will create a card id for future payments, on the second screen collect the amount which needs to be charged and will call the CreatePayment Method.

If I use the CVV as “911”, then screen one it’s self I am getting an exception as “CVV\_FAILURE”, because of this I am unable to create a Card Id and navigating into the second screen. Our requirement is the first screen should successfully generate the card Id while using that card in CreatePayment method I need to get an exception.

---

<div class="post-metadata">

**Author:** ![sjosey](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/sjosey/32/40_2.png) [@sjosey](https://developer.squareup.com/forums/u/sjosey)\
**Post date:** [October 21, 2020, 4:15pm UTC](https://developer.squareup.com/forums/t/make-declined-payment-using-createpayment-method/1095/8 "2020-10-21T16:15:28Z")

</div>

There’s no way to do this in our sandbox unfortunately. The `CreateCustomerCard` will verify it’s a real card, and if not, throw an error, so there’s no way to get past it to `CreatePayment` since it will always produce an error. You can make the error happen on either `CreateCustomerCard` or `CreatePayment`, but you can’t make it pass `CreateCustomerCard` and then pass on `CreatePayment` at this time.
