Skip to content

Commit

Permalink
Merge pull request #79 from mercadopago/feature/add-idempotency-on-re…
Browse files Browse the repository at this point in the history
…adme

add idempotency on documentation
  • Loading branch information
taliyada authored Feb 6, 2024
2 parents e2c1aaa + 914e04a commit 8e1cfd1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ require 'mercadopago'

sdk = Mercadopago::SDK.new('YOUR_ACCESS_TOKEN')

custom_headers = {
'x-idempotency-key': '<SOME_UNIQUE_VALUE>'
}

custom_request_options = Mercadopago::RequestOptions.new(custom_headers: custom_headers)

payment_data = {
transaction_amount: 100,
token: 'CARD_TOKEN',
Expand All @@ -39,7 +45,7 @@ payment_data = {
email: '[email protected]'
}
}
result = sdk.payment.create(payment_data)
result = sdk.payment.create(payment_data, custom_request_options)
payment = result[:response]

puts payment
Expand Down

0 comments on commit 8e1cfd1

Please sign in to comment.