Re-send a Membership Card Email

This procedure changes a production order and sends an email to a customer. Read What the procedure changes before the first run, and check the email against your own address first if you have not run the procedure on that site before.

1. Outcome

A member who paid for a membership receives the WooCommerce Completed order email again, with their membership card attached.

2. Cadence

On request, when a member reports that they paid and have no card. After an outage of the paid notification it is run for every order paid during the outage.

3. How a member receives a card

admin-service generates the card but does not email it. The card is generated when the payment plugin reports a membership order as paid, and is returned in that response. The plugin stores it on the WooCommerce order and attaches it to one email only, the Completed order email. See SMTP Configuration and WordPress Payment Implementation.

Two things follow, and together they shape this procedure:

  • WooCommerce sends the Completed order email only when an order moves to Completed. It has no action that sends that email again. The order action Send order details to customer sends the invoice email, which carries no card.

  • The card is attached only if it is on the order at the moment the email is built. If the paid notification failed when the member paid, the order has no card, and the email went out without one.

So re-sending a card means moving the order away from Completed and back, having first made sure the card is on the order.

4. Pre-flight

4.1. Find out which case you have

Open the order in WooCommerce and read its notes.

Order notes show Meaning Card on the order

Membership order sync to admin portal successful

The paid notification worked. The email was sent with the card and did not reach the member, or was overlooked.

Yes

ERROR: Failed to sync membership order to admin portal

The paid notification failed. The email was sent without a card.

No

The procedure is the same for both. In the second case the sync in the first step is what puts the card on the order.

4.2. Confirm the order qualifies

  • Its status is Completed.

  • It is a membership order managed by the plugin. The Manual Sync Order box on the order screen shows an admin order id.

  • It has a billing email.

4.3. Check the plugin version

The behaviour of a status change depends on the version of the Event Payment Plugin. The version is listed under WooCommerce > Status > System status > Active plugins.

Plugin version What a status change does

2.0.16 and earlier

Syncs the order to admin-service on every status change.

2.0.17 and later

Syncs unless the plugin has already recorded a successful sync of the order as paid. It records one after a successful sync from a status change or from the thank-you page. It records nothing when a sync fails.

The Sync Order button syncs on every version, whatever has been recorded.

On 2.0.17 and later the difference matters for one kind of order only:

The order A status change syncs Result

The paid notification failed, so no sync was recorded

Yes

The card is fetched. The procedure works as on 2.0.16.

The sync succeeded and the card is on the order

No

The card already on the order is attached.

The sync succeeded and the order has no card, because admin-service answered without one

No

Nothing fetches the card, and the email would go out without it. Only Sync Order helps.

The first step of the procedure exists for the third kind of order. Do not skip it.

5. Steps

  1. Open the order and press Sync Order in the Manual Sync Order box.

    Expect the order note Membership order sync to admin portal successful (manual admin sync). This puts the card on the order and sends nothing.

    If the note is an error instead, stop. Continuing would send the member another email without a card. See Recovery.

  2. Set the status to Processing and update the order.

    No email is sent. Moving from Completed to Processing is not a trigger for any customer or administrator email.

  3. Set the status to Completed and update the order.

    WooCommerce sends the Completed order email to the billing address. The plugin attaches the card.

  4. Read the order notes and confirm the last one is Order status changed from Processing to Completed. with no sync error after the first step.

Use only Processing and Completed. On hold, Pending payment, Cancelled and Refunded tell admin-service that the order is no longer paid, and the plugin then replaces the card stored on the order with nothing.

6. Checking the email before it goes to a member

Nothing records what an email contained after it is sent, so the only proof that the card is attached is an email you can read. On a site where the procedure has not been run before:

  1. Note the billing email of the order, then change it to your own address and update the order.

  2. Run the Steps.

  3. Confirm the email arrives with the card attached.

  4. Restore the billing email and update the order. This sends nothing, because the status does not change.

  5. Run the Steps again so that the member receives the email.

7. Running it for many orders

The same two status changes can be made through the WooCommerce REST API, which triggers the same sync and the same email. Use a key with read and write permission, over HTTPS with Basic authentication. Do not pass the key in the query string, which writes it to the access log of the site.

For each order, in this sequence:

  1. GET /wp-json/wc/v3/orders/12345 and confirm the order qualifies.

  2. PUT /wp-json/wc/v3/orders/12345 with the body {"status":"processing"}.

  3. GET the order again. Continue only if card_data in meta_data is not empty and the order notes show a successful sync since the previous step. If not, stop and leave the order in Processing.

  4. PUT /wp-json/wc/v3/orders/12345 with the body {"status":"completed"}.

The check between the two changes is what prevents a second email without a card. An order stopped there is left in Processing deliberately: returning it to Completed would send the email.

On plugin 2.0.17 and later, an order that was synced successfully without a card stops at the check, because the status change does not sync it again. Such an order needs Sync Order pressed in wp-admin, which the REST API of WooCommerce cannot do. Orders whose paid notification failed are not affected.

Pause a few seconds between orders. Each status change makes admin-service render a card, and each completed order sends an email through the mail service of the site.

8. What the procedure changes

Where Effect

WooCommerce order

The completed date becomes the date of the run. The paid date is unchanged. Order notes are added for the sync and for both status changes.

Membership

Unchanged. It stays active and keeps its start date, because admin-service sets a start date only on a membership that is not already active.

Stored cards

admin-service stores another copy of the card for every sync, so one run adds two or three copies per order.

Member

Receives a Completed order email with the same wording as the original.

9. Recovery

Symptom Cause Action

The sync adds an error note

admin-service rejected the notification or could not be reached.

Do not change the status. Find the request POST /api/memberships/order in the admin-service log, resolve the error, and sync again.

The sync succeeds and the order still has no card

admin-service answered successfully without a card. It logs a warning, Card generation failed for order, and still answers 200.

Do not change the status. Check that the report server is reachable from admin-service, then sync again.

The order was stopped in Processing

The card was not on the order after the first status change.

Press Sync Order, confirm the card is on the order, then set the status to Completed.

The email arrives without a card

The card was not on the order when the email was built.

Confirm the card is on the order and run the Steps again. With logging enabled the plugin writes Missing card attachment data for order to its log.

No email arrives

The Completed order email is disabled, or the message was not delivered.

Check WooCommerce > Settings > Emails, then the mail log of the site.

The plugin writes to WooCommerce > Status > Logs under the source event-payment-api, and only while Enable Logging is switched on in its settings.

10. Limitations

  • WooCommerce does not record that an email was sent, or what was attached to it. The checks in this procedure prove that the card was on the order, not that the member received it.

  • The procedure rewrites the completed date of the order. A report that selects orders by completed date will show a re-sent order on the date of the run.

  • admin-service cannot send the card itself. It keeps no email address for a membership order, so the address a member gave at checkout exists only in WooCommerce.

11. References