{"id":3376,"date":"2021-03-05T21:23:06","date_gmt":"2021-03-05T21:23:06","guid":{"rendered":"https:\/\/documents.openpay.mx\/?p=3376"},"modified":"2022-05-23T16:30:10","modified_gmt":"2022-05-23T16:30:10","slug":"op-form-charge","status":"publish","type":"post","link":"https:\/\/documents-mx-dev.opdevhm.com\/en\/docs\/op-form-charge.html","title":{"rendered":"Redirect"},"content":{"rendered":"
Example of creating a charge using the Openpay payment form.<\/blockquote>\n\n\n \n $openpay<\/span> =<\/span> Openpay<\/span>::<\/span>getInstance<\/span>(<\/span>'mzdtln0bmtms6o3kck8f'<\/span>,<\/span> 'sk_e568c42a6c384b7ab02cd47d2e407cab'<\/span>);<\/span>\n $customer<\/span> =<\/span> array<\/span><\/strong>(<\/span>\n 'name'<\/span> =><\/span> 'Mario'<\/span>,<\/span>\n 'last_name'<\/span> =><\/span> 'Benedetti Farrugia'<\/span>,<\/span>\n 'phone_number'<\/span> =><\/span> '1111111111'<\/span>,<\/span>\n 'email'<\/span> =><\/span> 'mario_benedetti@miempresa.mx'<\/span>);<\/span>\n $chargeRequest<\/span> =<\/span> array<\/span>(<\/span>\n \"method\"<\/span> :<\/span> \"card\"<\/span>,<\/span>\n 'amount'<\/span> =><\/span> 111<\/span>,<\/span>\n 'description'<\/span> =><\/span> 'Cargo desde terminal virtual de 111'<\/span>,<\/span>\n 'customer'<\/span> =><\/span> $customer<\/span>,<\/span>\n 'send_email'<\/span> =><\/span> false<\/span><\/strong>,<\/span>\n 'confirm'<\/span> =><\/span> false<\/span><\/strong>,<\/span>\n 'redirect_url'<\/span> =><\/span> 'http:\/\/www.openpay.mx\/index.html'<\/span>\n )<\/span> ;<\/span>\n $charge<\/span> =<\/span> $openpay<\/span>-><\/span>charges<\/span>-><\/span>create<\/span>(<\/span> $chargeRequest<\/span>);<\/span><\/code><\/pre>\n<\/figure>\n<\/div>\nRedirect to the Openpay form<\/h2>\nIf the call is correct then a response will be returned with a transaction object.<\/a> in the pending state represented in the language used.\n\nResponse:<\/strong>\n
\n {<\/span>\n \"id\"<\/span>:<\/span> \"trq7yrthx5vc4gtjdkwg\"<\/span>,<\/span>\n \"authorization\"<\/span>:<\/span> null<\/span><\/strong>,<\/span>\n \"method\"<\/span>:<\/span> \"card\"<\/span>,<\/span>\n \"operation_type\"<\/span>:<\/span> \"in\"<\/span>,<\/span>\n \"transaction_type\"<\/span>:<\/span> \"charge\"<\/span>,<\/span>\n \"status\"<\/span>:<\/span> \"charge_pending\"<\/span>,<\/span>\n \"conciliated\"<\/span>:<\/span> false<\/span><\/strong>,<\/span>\n \"creation_date\"<\/span>:<\/span> \"2016-09-09T18:52:02-05:00\"<\/span>,<\/span>\n \"operation_date\"<\/span>:<\/span> \"2016-09-09T18:52:02-05:00\"<\/span>,<\/span>\n \"description\"<\/span>:<\/span> \"Cargo desde terminal virtual de 111\"<\/span>,<\/span>\n \"error_message\"<\/span>:<\/span> null<\/span><\/strong>,<\/span>\n \"amount\"<\/span>:<\/span> 111<\/span>,<\/span>\n \"currency\"<\/span>:<\/span> \"MXN\"<\/span>,<\/span>\n \"payment_method\"<\/span>:<\/span> {<\/span>\n \"type\"<\/span>:<\/span> \"redirect\"<\/span>,<\/span>\n \"url\"<\/span>:<\/span> \"https:\/\/sandbox-api.openpay.mx\/v1\/mexzhpxok3houd5lbvz1\/charges\/trq7yrthx5vc4gtjdkwg\/card_capture\"<\/span><\/em><\/strong>\n },<\/span>\n \"customer\"<\/span>:<\/span> {<\/span>\n \"name\"<\/span>:<\/span> \"Mario\"<\/span>,<\/span>\n \"last_name\"<\/span>:<\/span> \"Benedetti Farrugia\"<\/span>,<\/span>\n \"email\"<\/span>:<\/span> \"mario_benedetti@miempresa.mx\"<\/span>,<\/span>\n \"phone_number\"<\/span>:<\/span> \"1111111111\"<\/span>,<\/span>\n \"creation_date\"<\/span>:<\/span> \"2016-09-09T18:52:02-05:00\"<\/span>,<\/span>\n \"clabe\"<\/span>:<\/span> null<\/span><\/strong>,<\/span>\n \"external_id\"<\/span>:<\/span> null<\/span><\/strong>\n }<\/span>\n}<\/span><\/code><\/pre>\n<\/figure>\nRedirect the user to the url contained in the url attribute that is inside the payment_method object.\n\n\n
Fill payment data<\/h2>\nThat the user fill in the requested information and click on Make payment<\/em><\/strong>\n\n
\n
Click on Continue<\/h2>\nIf the payment was successful the user clicked on Continue<\/em><\/strong>\n\n
\n\nThis redirects to the url that was provided when creating the charge (in the case of the Openpay page example), terminating the payment flow.\n\n
\n
Notes:<\/strong>\n\n \t
- You can simulate different results using the cards Testing<\/a><\/li>\n \t
- Implement the Notifications<\/a> to know the status of payments in real time<\/li>\n<\/ul>\n<\/blockquote>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"
Otra forma de hacer cargos con tarjeta sin la necesidad de implementar un formulario de pago en tu sitio, es mediante la utilizaci\u00f3n de un formulario que Openpay proporciona. Resumen de pasos: Crear un cargo que contenga el atributo confirm en false y una url a la cual direccionar una vez concluido el pago. En… Read More »Redirect<\/span><\/a><\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[133],"tags":[],"class_list":["post-3376","post","type-post","status-publish","format-standard","hentry","category-docs"],"yoast_head":"\n
Redireccionamiento | Openpay<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n