• Resolved careyrob

    (@careyrob)


    If I process a transaction through woo-mp and then attempt to issue a partial refund through the Woocommerce Stripe Gateway plugin it always it results in a full refund.

    I create these refunds by clicking the standard woocommerce “refund” button and reducing the quantity of the items being refunded. This loads the appropriate refund amount in the refund form so that I only need to click the “Refund $xx.xx via Stripe” button to complete the refund.

    Woocommerce support says that it’s because of the way woo-mp transactions are processed.

    Here is how the order items table looks after the most recent partial refund attempt:

    https://prntscr.com/o9msxc

    The Refunds Post Meta data indicates that only the intended partial amount has been refunded, but the stripe dashboard shows that the entire transaction total has been refunded. How do I fix this so it won’t happen again?

    Refund Post Meta refund_id: 15533 refund_name: Refund – Jul 02, 2019 @ 04:03 PM refund_status: wc-completed ? _vc_post_settings a:1:{s:10:”vc_grid_id”;a:0:{}} ? _order_currency USD ? _cart_discount 0 ? _cart_discount_tax 0 ? _order_shipping 0 ? _order_shipping_tax 0 ? _order_tax 0 ? _order_total -150.00 ? _order_version 3.6.4 ? _prices_include_tax no ? _refund_amount 150.00 ? _refunded_by 1 ? _refunded_payment 1 ? _refund_reason Course Transfer ? _wcpdf_credit_note_settings a:20:{s:7:”enabled”;s:1:”1″;s:5:”title”;a:1:{s:7:”default”;s:0:””;}s:8:”filename”;a:1:{s:7:”default”;s:0:””;}s:19:”attach_to_email_ids”;a:3:{s:23:”customer_refunded_order”;s:1:”1″;s:16:”customer_invoice”;s:1:”1″;s:20:”customer_credit_note”;s:1:”1″;}s:13:”display_email”;s:1:”1″;s:13:”display_phone”;s:1:”1″;s:12:”display_date”;s:1:”1″;s:15:”number_sequence”;s:18:”credit_note_number”;s:23:”original_invoice_number”;s:1:”1″;s:13:”number_format”;a:3:{s:6:”prefix”;s:0:””;s:6:”suffix”;s:0:””;s:7:”padding”;s:0:””;}s:19:”use_latest_settings”;s:1:”1″;s:10:”paper_size”;s:6:”letter”;s:15:”font_subsetting”;b:0;s:11:”header_logo”;s:4:”6832″;s:9:”shop_name”;a:1:{s:7:”default”;s:16:”SkillWorks, Inc.”;}s:12:”shop_address”;a:1:{s:7:”default”;s:97:”SkillWorks, Inc. 92 Coolidge Circle Northborough, MA 01532 (508) 393-3973 https://www.skillworks.com”;}s:6:”footer”;a:1:{s:7:”default”;s:70:”*Payment required before successful course completions are certified.*”;}s:7:”extra_1″;a:1:{s:7:”default”;s:0:””;}s:7:”extra_2″;a:1:{s:7:”default”;s:0:””;}s:7:”extra_3″;a:1:{s:7:”default”;s:0:””;}} ? _wcpdf_credit_note_date 1562083404 ? _wcpdf_credit_note_date_formatted 2019-07-02 11:03:24 ? _wcpdf_credit_note_number 4 ? _wcpdf_credit_note_number_data a:7:{s:6:”number”;i:4;s:16:”formatted_number”;s:1:”4″;s:6:”prefix”;s:0:””;s:6:”suffix”;s:0:””;s:13:”document_type”;s:11:”credit-note”;s:8:”order_id”;i:15533;s:7:”padding”;s:0:””;} Stripe Refund Event Data Event data { “object”: { “id”: “ch_1Eq0lYJpj9xw4zM563xZWOVp”, “object”: “charge”, “amount”: 55500, “amount_refunded”: 55500, “application”: null, “application_fee”: null, “application_fee_amount”: null, “balance_transaction”: “txn_1Eq0lZJpj9xw4zM50cIESaDl”, “billing_details”: { “address”: { “city”: null, “country”: null, “line1”: null, “line2”: null, “postal_code”: null, “state”: null }, “email”: null, “name”: null, “phone”: null }, “captured”: true, “created”: 1561654088, “currency”: “usd”, “customer”: null, “description”: “SkillWorks, Inc. – Invoice 14520”, “destination”: null, “dispute”: null, “failure_code”: null, “failure_message”: null, “fraud_details”: { }, “invoice”: null, “livemode”: true, “metadata”: { “customer_name”: “[data removed for this ticket]”, “customer_email”: “[data removed for this ticket]”, “order_id”: “14520”, “invoice_id”: “14520” }, “on_behalf_of”: null, “order”: null, “outcome”: { “network_status”: “approved_by_network”, “reason”: null, “risk_level”: “normal”, “seller_message”: “Payment complete.”, “type”: “authorized” }, “paid”: true, “payment_intent”: null, “payment_method”: “card_1Eq0lVJpj9xw4zM5QXhALsfE”, “payment_method_details”: { “card”: { “brand”: “[data removed for this ticket]”, “checks”: { “address_line1_check”: null, “address_postal_code_check”: null, “cvc_check”: “pass” }, “country”: “[data removed for this ticket]”, “exp_month”: [data removed for this ticket], “exp_year”: [data removed for this ticket], “fingerprint”: “vHUNNGeiH7ZJxp4F”, “funding”: “credit”, “last4”: “[data removed for this ticket]”, “three_d_secure”: null, “wallet”: null }, “type”: “card” }, “receipt_email”: null, “receipt_number”: “1721-2219”, “receipt_url”: “https://pay.stripe.com/receipts/acct_1BHGqsJpj9xw4zM5/ch_1Eq0lYJpj9xw4zM563xZWOVp/rcpt_FKg7KOCS359yizBNcs4BnKkE8lXp7z3”, “refunded”: true, “refunds”: { “object”: “list”, “data”: [ { “id”: “re_1EroRxJpj9xw4zM5GgeXlyFI”, “object”: “refund”, “amount”: 55500, “balance_transaction”: “txn_1EroRyJpj9xw4zM55PtqNnVh”, “charge”: “ch_1Eq0lYJpj9xw4zM563xZWOVp”, “created”: 1562083401, “currency”: “usd”, “metadata”: { “reason”: “Course Transfer” }, “reason”: null, “receipt_number”: null, “source_transfer_reversal”: null, “status”: “succeeded”, “transfer_reversal”: null } ], “has_more”: false, “total_count”: 1, “url”: “/v1/charges/ch_1Eq0lYJpj9xw4zM563xZWOVp/refunds” }, “review”: null, “shipping”: null, “source”: { “id”: “card_1Eq0lVJpj9xw4zM5QXhALsfE”, “object”: “card”, “address_city”: null, “address_country”: null, “address_line1”: null, “address_line1_check”: null, “address_line2”: null, “address_state”: null, “address_zip”: null, “address_zip_check”: null, “brand”: “[data removed for this ticket]”, “country”: “[data removed for this ticket]”, “customer”: null, “cvc_check”: “pass”, “dynamic_last4”: null, “exp_month”: [data removed for this ticket], “exp_year”: [data removed for this ticket], “fingerprint”: “vHUNNGeiH7ZJxp4F”, “funding”: “credit”, “last4”: “[data removed for this ticket]”, “metadata”: { }, “name”: null, “tokenization_method”: null }, “source_transfer”: null, “statement_descriptor”: null, “status”: “succeeded”, “transfer_data”: null, “transfer_group”: null }, “previous_attributes”: { “amount_refunded”: 0, “refunded”: false, “refunds”: { “data”: [ ], “total_count”: 0 } } }

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author bfl

    (@bfl)

    Hey @careyrob. The official Stripe plugin is only supposed to be used to refund payments made by that plugin. It expects certain metadata to be added to the order at the time of payment. One of those fields indicates whether the payment has been captured. This field is not set by our plugin (as it is not used by WooCommerce core), so when the Stripe plugin looks for it and doesn’t find it, it assumes that the payment was not captured. As a result, they do not send the refund amount to Stripe. This causes the payment to be fully refunded.

    Thread Starter careyrob

    (@careyrob)

    What is the field called that needs to be set?

    Plugin Author bfl

    (@bfl)

    If the payment is captured, the _stripe_charge_captured field needs to be set to yes.

    Thread Starter careyrob

    (@careyrob)

    I see that woo-mp records transaction data as a json string.

    Is the requirement any more complicated than posting a meta_data entry for _stripe_charge_captured at the same time as the woo-mp transaction meta_data or is additional validation required?

    Plugin Author bfl

    (@bfl)

    That should do it.

    Thread Starter careyrob

    (@careyrob)

    How about this snippet? Is this the right condition for adding this meta_data to the order?

    add_action( 'woo_mp_payment_complete', function ( $order ) {
    	$order->update_meta_data( '_stripe_charge_captured', 'yes' );
    	$order->save();
    }, 10, 1 );
    Plugin Author bfl

    (@bfl)

    Yes, that snippet should work.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘plugin conflict w/ WooCommerce Stripe Gateway refunds’ is closed to new replies.